e2e: split and move api e2e tests into it's own package (#4751)

* e2e: move api e2e tests into api package

* move api e2e tests into test-e2e-api target and CI job

* fix lint
This commit is contained in:
Suraj Nath
2025-02-26 12:15:27 +05:30
committed by GitHub
parent 8263d353e7
commit f8339e6053
19 changed files with 38 additions and 29 deletions

View File

@ -86,6 +86,7 @@ jobs:
test-target: test-target:
[ [
test-e2e, test-e2e,
test-e2e-api,
test-integration-poller, test-integration-poller,
test-e2e-deployments, test-e2e-deployments,
] ]

1
.gitignore vendored
View File

@ -20,6 +20,7 @@
/tempodb/encoding/benchmark_block /tempodb/encoding/benchmark_block
private-key.key private-key.key
integration/e2e/e2e_integration_test[0-9]* integration/e2e/e2e_integration_test[0-9]*
integration/e2e/api/e2e_integration_test[0-9]*
integration/e2e/deployments/e2e_integration_test[0-9]* integration/e2e/deployments/e2e_integration_test[0-9]*
.tempo.yaml .tempo.yaml
/tmp /tmp

View File

@ -133,6 +133,11 @@ test-e2e: tools docker-tempo docker-tempo-query ## Run end to end tests
test-e2e-deployments: tools docker-tempo docker-tempo-query ## Run end to end tests for deployments test-e2e-deployments: tools docker-tempo docker-tempo-query ## Run end to end tests for deployments
$(GOTEST) -v $(GOTEST_OPT) ./integration/e2e/deployments $(GOTEST) -v $(GOTEST_OPT) ./integration/e2e/deployments
# runs only api e2e tests
.PHONY: test-e2e-api
test-e2e-api: tools docker-tempo docker-tempo-query ## Run end to end tests for api
$(GOTEST) -v $(GOTEST_OPT) ./integration/e2e/api
# runs only poller integration tests # runs only poller integration tests
.PHONY: test-integration-poller .PHONY: test-integration-poller
test-integration-poller: tools ## Run poller integration tests test-integration-poller: tools ## Run poller integration tests
@ -140,7 +145,7 @@ test-integration-poller: tools ## Run poller integration tests
# test-all/bench use a docker image so build it first to make sure we're up to date # 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 .PHONY: test-all ## Run all tests
test-all: test-with-cover test-e2e test-e2e-deployments test-integration-poller test-all: test-with-cover test-e2e test-e2e-deployments test-e2e-api test-integration-poller
.PHONY: test-bench .PHONY: test-bench
test-bench: tools docker-tempo ## Run all benchmarks test-bench: tools docker-tempo ## Run all benchmarks

View File

@ -1,4 +1,4 @@
package e2e package api
import ( import (
"context" "context"
@ -23,8 +23,9 @@ import (
) )
const ( const (
spanX = "span.x" configAllInOneLocal = "../deployments/config-all-in-one-local.yaml"
resourceX = "resource.xx" spanX = "span.x"
resourceX = "resource.xx"
) )
func TestSearchTagsV2(t *testing.T) { func TestSearchTagsV2(t *testing.T) {

View File

@ -1,4 +1,4 @@
package e2e package api
import ( import (
"compress/gzip" "compress/gzip"
@ -17,7 +17,7 @@ import (
) )
const ( const (
configCompression = "deployments/config-all-in-one-local.yaml" configCompression = "../deployments/config-all-in-one-local.yaml"
) )
func TestCompression(t *testing.T) { func TestCompression(t *testing.T) {

View File

@ -1,4 +1,4 @@
package e2e package api
import ( import (
"testing" "testing"

View File

@ -1,4 +1,4 @@
package e2e package api
import ( import (
"context" "context"

View File

@ -1,4 +1,4 @@
package e2e package api
import ( import (
"context" "context"
@ -66,7 +66,8 @@ func testSearch(t *testing.T, tenant string, tenantSize int) {
require.NoError(t, util.CopyFileToSharedDir(s, configMultiTenant, "config.yaml")) require.NoError(t, util.CopyFileToSharedDir(s, configMultiTenant, "config.yaml"))
tempo := util.NewTempoAllInOne() tempo := util.NewTempoAllInOne()
require.NoError(t, s.StartAndWaitReady(tempo, newPrometheus())) prometheus := util.NewPrometheus()
require.NoError(t, s.StartAndWaitReady(tempo, prometheus))
// Get port for the Jaeger gRPC receiver endpoint // Get port for the Jaeger gRPC receiver endpoint
c, err := util.NewJaegerGRPCClient(tempo.Endpoint(14250)) c, err := util.NewJaegerGRPCClient(tempo.Endpoint(14250))

View File

@ -1,4 +1,4 @@
package e2e package api
import ( import (
"context" "context"

View File

@ -1,4 +1,4 @@
package e2e package api
import ( import (
"context" "context"

View File

@ -24,7 +24,6 @@ import (
const ( const (
configMetricsGenerator = "config-metrics-generator.yaml" configMetricsGenerator = "config-metrics-generator.yaml"
configMetricsGeneratorTargetInfo = "config-metrics-generator-targetinfo.yaml" configMetricsGeneratorTargetInfo = "config-metrics-generator-targetinfo.yaml"
prometheusImage = "prom/prometheus:latest"
) )
func TestMetricsGenerator(t *testing.T) { func TestMetricsGenerator(t *testing.T) {
@ -36,7 +35,7 @@ func TestMetricsGenerator(t *testing.T) {
tempoDistributor := util.NewTempoDistributor() tempoDistributor := util.NewTempoDistributor()
tempoIngester := util.NewTempoIngester(1) tempoIngester := util.NewTempoIngester(1)
tempoMetricsGenerator := util.NewTempoMetricsGenerator() tempoMetricsGenerator := util.NewTempoMetricsGenerator()
prometheus := newPrometheus() prometheus := util.NewPrometheus()
require.NoError(t, s.StartAndWaitReady(tempoDistributor, tempoIngester, tempoMetricsGenerator, prometheus)) require.NoError(t, s.StartAndWaitReady(tempoDistributor, tempoIngester, tempoMetricsGenerator, prometheus))
// Wait until ingester and metrics-generator are active // Wait until ingester and metrics-generator are active
@ -225,7 +224,7 @@ func TestMetricsGeneratorTargetInfoEnabled(t *testing.T) {
tempoDistributor := util.NewTempoDistributor() tempoDistributor := util.NewTempoDistributor()
tempoIngester := util.NewTempoIngester(1) tempoIngester := util.NewTempoIngester(1)
tempoMetricsGenerator := util.NewTempoMetricsGenerator() tempoMetricsGenerator := util.NewTempoMetricsGenerator()
prometheus := newPrometheus() prometheus := util.NewPrometheus()
require.NoError(t, s.StartAndWaitReady(tempoDistributor, tempoIngester, tempoMetricsGenerator, prometheus)) require.NoError(t, s.StartAndWaitReady(tempoDistributor, tempoIngester, tempoMetricsGenerator, prometheus))
// Wait until ingester and metrics-generator are active // Wait until ingester and metrics-generator are active
@ -387,16 +386,6 @@ func TestMetricsGeneratorTargetInfoEnabled(t *testing.T) {
assert.NoError(t, tempoMetricsGenerator.WaitSumMetrics(e2e.Equals(25), "tempo_metrics_generator_registry_series_added_total")) assert.NoError(t, tempoMetricsGenerator.WaitSumMetrics(e2e.Equals(25), "tempo_metrics_generator_registry_series_added_total"))
} }
func newPrometheus() *e2e.HTTPService {
return e2e.NewHTTPService(
"prometheus",
prometheusImage,
e2e.NewCommandWithoutEntrypoint("/bin/prometheus", "--config.file=/etc/prometheus/prometheus.yml", "--web.enable-remote-write-receiver"),
e2e.NewHTTPReadinessProbe(9090, "/-/ready", 200, 299),
9090,
)
}
// extractMetricsFromPrometheus extracts metrics stored in Prometheus using the /federate endpoint. // extractMetricsFromPrometheus extracts metrics stored in Prometheus using the /federate endpoint.
func extractMetricsFromPrometheus(prometheus *e2e.HTTPService, matcher string) (map[string]*io_prometheus_client.MetricFamily, error) { func extractMetricsFromPrometheus(prometheus *e2e.HTTPService, matcher string) (map[string]*io_prometheus_client.MetricFamily, error) {
url := fmt.Sprintf("http://%s/federate?match[]=%s", prometheus.HTTPEndpoint(), url.QueryEscape(matcher)) url := fmt.Sprintf("http://%s/federate?match[]=%s", prometheus.HTTPEndpoint(), url.QueryEscape(matcher))

View File

@ -44,10 +44,11 @@ import (
) )
const ( const (
image = "tempo:latest" image = "tempo:latest"
debugImage = "tempo-debug:latest" debugImage = "tempo-debug:latest"
queryImage = "tempo-query:latest" queryImage = "tempo-query:latest"
jaegerImage = "jaegertracing/jaeger-query:1.64.0" jaegerImage = "jaegertracing/jaeger-query:1.64.0"
prometheusImage = "prom/prometheus:latest"
) )
// GetExtraArgs returns the extra args to pass to the Docker command used to run Tempo. // GetExtraArgs returns the extra args to pass to the Docker command used to run Tempo.
@ -640,3 +641,13 @@ func SpanCount(a *tempopb.Trace) float64 {
return float64(count) return float64(count)
} }
func NewPrometheus() *e2e.HTTPService {
return e2e.NewHTTPService(
"prometheus",
prometheusImage,
e2e.NewCommandWithoutEntrypoint("/bin/prometheus", "--config.file=/etc/prometheus/prometheus.yml", "--web.enable-remote-write-receiver"),
e2e.NewHTTPReadinessProbe(9090, "/-/ready", 200, 299),
9090,
)
}