Skip to content

Commit

Permalink
Reorganise e2e tests (grafana#3927)
Browse files Browse the repository at this point in the history
* Move heavy e2e to new folder

* Ups

* Ups 2

* Ups final

* What about now?

* Split e2e targets even further

* Names
  • Loading branch information
mapno authored Aug 1, 2024
1 parent 195936e commit 5ce539d
Show file tree
Hide file tree
Showing 28 changed files with 800 additions and 730 deletions.
29 changes: 28 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,38 @@ jobs:
- name: Test
run: make test-e2e

integration-tests-poller:
name: Test integration e2e suite - poller
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.22
uses: actions/setup-go@v5
with:
go-version: '>=1.22.4'

- name: Check out code
uses: actions/checkout@v4

- name: Poller
run: make test-integration-poller

integration-tests-deployment-modes:
name: Test integration e2e suite - deployment modes
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.22
uses: actions/setup-go@v5
with:
go-version: '>=1.22.4'

- name: Check out code
uses: actions/checkout@v4

- name: Deployment modes
run: make test-e2e-deployments

integration-tests-serverless:
name: Test serverless integration e2e suite
name: Test integration e2e suite - serverless
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.22
Expand Down
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,19 @@ test-e2e: tools docker-tempo docker-tempo-query ## Run end to end tests
test-e2e-serverless: tools docker-tempo docker-serverless ## Run serverless end to end tests
$(GOTEST) -v $(GOTEST_OPT) ./integration/e2e/serverless

# runs only deployment modes e2e tests
.PHONY: test-e2e-deployments
test-e2e-deployments: tools docker-tempo docker-tempo-query ## Run end to end tests for deployments
$(GOTEST) -v $(GOTEST_OPT) ./integration/e2e/deployments

# runs only poller integration tests
.PHONY: test-integration-poller
test-integration-poller: tools ## Run poller integration tests
$(GOTEST) -v $(GOTEST_OPT) ./integration/poller

# test-all/bench use a docker image so build it first to make sure we're up to date
.PHONY: test-all ## Run all tests
test-all: test-with-cover test-e2e test-e2e-serverless test-integration-poller
test-all: test-with-cover test-e2e test-e2e-serverless test-e2e-deployments test-integration-poller

.PHONY: test-bench
test-bench: tools docker-tempo ## Run all benchmarks
Expand Down
2 changes: 1 addition & 1 deletion integration/bench/load_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"path/filepath"
"testing"

util "github.com/grafana/tempo/integration"
"github.com/grafana/tempo/integration/util"

"github.com/grafana/e2e"
e2e_db "github.com/grafana/e2e/db"
Expand Down
30 changes: 15 additions & 15 deletions integration/e2e/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"time"

"github.com/grafana/e2e"
util "github.com/grafana/tempo/integration"
"github.com/grafana/tempo/integration/util"
"github.com/grafana/tempo/pkg/tempopb"
"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -48,10 +48,10 @@ func TestSearchTagsV2(t *testing.T) {
firstBatch := batchTmpl{spanCount: 2, name: "foo", resourceAttVal: "bar", spanAttVal: "bar", resourceAttr: "firstRes", SpanAttr: "firstSpan"}
secondBatch := batchTmpl{spanCount: 2, name: "baz", resourceAttVal: "qux", spanAttVal: "qux", resourceAttr: "secondRes", SpanAttr: "secondSpan"}

batch := makeThriftBatchWithSpanCountAttributeAndName(firstBatch.spanCount, firstBatch.name, firstBatch.resourceAttVal, firstBatch.spanAttVal, firstBatch.resourceAttr, firstBatch.SpanAttr)
batch := util.MakeThriftBatchWithSpanCountAttributeAndName(firstBatch.spanCount, firstBatch.name, firstBatch.resourceAttVal, firstBatch.spanAttVal, firstBatch.resourceAttr, firstBatch.SpanAttr)
require.NoError(t, jaegerClient.EmitBatch(context.Background(), batch))

batch = makeThriftBatchWithSpanCountAttributeAndName(secondBatch.spanCount, secondBatch.name, secondBatch.resourceAttVal, secondBatch.spanAttVal, secondBatch.resourceAttr, secondBatch.SpanAttr)
batch = util.MakeThriftBatchWithSpanCountAttributeAndName(secondBatch.spanCount, secondBatch.name, secondBatch.resourceAttVal, secondBatch.spanAttVal, secondBatch.resourceAttr, secondBatch.SpanAttr)
require.NoError(t, jaegerClient.EmitBatch(context.Background(), batch))

// Wait for the traces to be written to the WAL
Expand Down Expand Up @@ -237,9 +237,9 @@ func TestSearchTagsV2(t *testing.T) {

// Wait to block flushed to backend, 20 seconds is the complete_block_timeout configuration on all in one, we add
// 2s for security.
callFlush(t, tempo)
util.CallFlush(t, tempo)
time.Sleep(time.Second * 22)
callFlush(t, tempo)
util.CallFlush(t, tempo)

// test metrics
require.NoError(t, tempo.WaitSumMetrics(e2e.Equals(1), "tempo_ingester_blocks_flushed_total"))
Expand Down Expand Up @@ -290,10 +290,10 @@ func TestSearchTagValuesV2(t *testing.T) {
firstBatch := batchTmpl{spanCount: 2, name: "foo", resourceAttVal: "bar", spanAttVal: "bar"}
secondBatch := batchTmpl{spanCount: 2, name: "baz", resourceAttVal: "qux", spanAttVal: "qux"}

batch := makeThriftBatchWithSpanCountAttributeAndName(firstBatch.spanCount, firstBatch.name, firstBatch.resourceAttVal, firstBatch.spanAttVal, "xx", "x")
batch := util.MakeThriftBatchWithSpanCountAttributeAndName(firstBatch.spanCount, firstBatch.name, firstBatch.resourceAttVal, firstBatch.spanAttVal, "xx", "x")
require.NoError(t, jaegerClient.EmitBatch(context.Background(), batch))

batch = makeThriftBatchWithSpanCountAttributeAndName(secondBatch.spanCount, secondBatch.name, secondBatch.resourceAttVal, secondBatch.spanAttVal, "xx", "x")
batch = util.MakeThriftBatchWithSpanCountAttributeAndName(secondBatch.spanCount, secondBatch.name, secondBatch.resourceAttVal, secondBatch.spanAttVal, "xx", "x")
require.NoError(t, jaegerClient.EmitBatch(context.Background(), batch))

// Wait for the traces to be written to the WAL
Expand Down Expand Up @@ -410,9 +410,9 @@ func TestSearchTagValuesV2(t *testing.T) {

// Wait to block flushed to backend, 20 seconds is the complete_block_timeout configuration on all in one, we add
// 2s for security.
callFlush(t, tempo)
util.CallFlush(t, tempo)
time.Sleep(time.Second * 22)
callFlush(t, tempo)
util.CallFlush(t, tempo)

// test metrics
require.NoError(t, tempo.WaitSumMetrics(e2e.Equals(1), "tempo_ingester_blocks_flushed_total"))
Expand Down Expand Up @@ -455,16 +455,16 @@ func TestSearchTags(t *testing.T) {
require.NoError(t, err)
require.NotNil(t, jaegerClient)

batch := makeThriftBatch()
batch := util.MakeThriftBatch()
require.NoError(t, jaegerClient.EmitBatch(context.Background(), batch))

// Wait for the traces to be written to the WAL
time.Sleep(time.Second * 3)
callSearchTagsAndAssert(t, tempo, searchTagsResponse{TagNames: []string{"service.name", "x", "xx"}}, 0, 0)

callFlush(t, tempo)
util.CallFlush(t, tempo)
time.Sleep(time.Second * 30)
callFlush(t, tempo)
util.CallFlush(t, tempo)

// test metrics
require.NoError(t, tempo.WaitSumMetrics(e2e.Equals(1), "tempo_ingester_blocks_flushed_total"))
Expand Down Expand Up @@ -496,16 +496,16 @@ func TestSearchTagValues(t *testing.T) {
require.NoError(t, err)
require.NotNil(t, jaegerClient)

batch := makeThriftBatch()
batch := util.MakeThriftBatch()
require.NoError(t, jaegerClient.EmitBatch(context.Background(), batch))

// Wait for the traces to be written to the WAL
time.Sleep(time.Second * 3)
callSearchTagValuesAndAssert(t, tempo, "service.name", searchTagValuesResponse{TagValues: []string{"my-service"}}, 0, 0)

callFlush(t, tempo)
util.CallFlush(t, tempo)
time.Sleep(time.Second * 22)
callFlush(t, tempo)
util.CallFlush(t, tempo)

require.NoError(t, tempo.WaitSumMetrics(e2e.Equals(1), "tempo_ingester_blocks_flushed_total"))
require.NoError(t, tempo.WaitSumMetricsWithOptions(e2e.Equals(1), []string{"tempodb_blocklist_length"}, e2e.WaitMissingMetrics))
Expand Down
2 changes: 1 addition & 1 deletion integration/e2e/backend/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (

"github.com/grafana/e2e"
e2e_db "github.com/grafana/e2e/db"
"github.com/grafana/tempo/integration/util"

"github.com/grafana/tempo/cmd/tempo/app"
util "github.com/grafana/tempo/integration"
"github.com/grafana/tempo/tempodb/backend"
"github.com/grafana/tempo/tempodb/backend/azure"
)
Expand Down
10 changes: 5 additions & 5 deletions integration/e2e/compression_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ import (
"time"

"github.com/grafana/e2e"
"github.com/grafana/tempo/integration/util"
"github.com/stretchr/testify/require"

util "github.com/grafana/tempo/integration"
"github.com/grafana/tempo/pkg/httpclient"
"github.com/grafana/tempo/pkg/tempopb"
tempoUtil "github.com/grafana/tempo/pkg/util"
)

const (
configCompression = "config-all-in-one-local.yaml"
configCompression = "deployments/config-all-in-one-local.yaml"
)

func TestCompression(t *testing.T) {
Expand All @@ -41,7 +41,7 @@ func TestCompression(t *testing.T) {

apiClientWithCompression := httpclient.NewWithCompression("http://"+tempo.Endpoint(3200), "")

queryAndAssertTrace(t, apiClient, info)
util.QueryAndAssertTrace(t, apiClient, info)
queryAndAssertTraceCompression(t, apiClientWithCompression, info)
}

Expand All @@ -53,7 +53,7 @@ func queryAndAssertTraceCompression(t *testing.T, client *httpclient.Client, inf

expected, err := info.ConstructTraceFromEpoch()
require.NoError(t, err)
assertEqualTrace(t, result, expected)
util.AssertEqualTrace(t, result, expected)

// Go's http.Client transparently requests gzip compression and automatically decompresses the
// response, to disable this behaviour you have to explicitly set the Accept-Encoding header.
Expand All @@ -79,5 +79,5 @@ func queryAndAssertTraceCompression(t *testing.T, client *httpclient.Client, inf
err = tempopb.UnmarshalFromJSONV1(bodyBytes, m)

require.NoError(t, err)
assertEqualTrace(t, expected, m)
util.AssertEqualTrace(t, expected, m)
}
6 changes: 3 additions & 3 deletions integration/e2e/cross_cluster_reads_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (

"github.com/grafana/e2e"
e2edb "github.com/grafana/e2e/db"
"github.com/grafana/tempo/integration/util"
"github.com/prometheus/prometheus/model/labels"
"github.com/stretchr/testify/require"

util "github.com/grafana/tempo/integration"
"github.com/grafana/tempo/pkg/httpclient"
tempoUtil "github.com/grafana/tempo/pkg/util"
)
Expand Down Expand Up @@ -44,13 +44,13 @@ func TestCrossClusterReads(t *testing.T) {
require.NoError(t, err)

// test metrics
require.NoError(t, tempoDistributorA.WaitSumMetrics(e2e.Equals(spanCount(expected)), "tempo_distributor_spans_received_total"))
require.NoError(t, tempoDistributorA.WaitSumMetrics(e2e.Equals(util.SpanCount(expected)), "tempo_distributor_spans_received_total"))

// read from cluster B
apiClient := httpclient.New("http://"+tempoQueryFrontendB.Endpoint(3200), "")

// query an in-memory trace
queryAndAssertTrace(t, apiClient, info)
util.QueryAndAssertTrace(t, apiClient, info)
}

func createCluster(t *testing.T, s *e2e.Scenario, postfix string) (*e2e.HTTPService, *e2e.HTTPService) {
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 5ce539d

Please sign in to comment.