mirror of
https://github.com/grafana/tempo.git
synced 2025-03-14 03:06:42 +00:00
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:
1
.github/workflows/ci.yml
vendored
1
.github/workflows/ci.yml
vendored
@ -86,6 +86,7 @@ jobs:
|
||||
test-target:
|
||||
[
|
||||
test-e2e,
|
||||
test-e2e-api,
|
||||
test-integration-poller,
|
||||
test-e2e-deployments,
|
||||
]
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -20,6 +20,7 @@
|
||||
/tempodb/encoding/benchmark_block
|
||||
private-key.key
|
||||
integration/e2e/e2e_integration_test[0-9]*
|
||||
integration/e2e/api/e2e_integration_test[0-9]*
|
||||
integration/e2e/deployments/e2e_integration_test[0-9]*
|
||||
.tempo.yaml
|
||||
/tmp
|
||||
|
7
Makefile
7
Makefile
@ -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
|
||||
$(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
|
||||
.PHONY: test-integration-poller
|
||||
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
|
||||
.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
|
||||
test-bench: tools docker-tempo ## Run all benchmarks
|
||||
|
@ -1,4 +1,4 @@
|
||||
package e2e
|
||||
package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
@ -23,8 +23,9 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
spanX = "span.x"
|
||||
resourceX = "resource.xx"
|
||||
configAllInOneLocal = "../deployments/config-all-in-one-local.yaml"
|
||||
spanX = "span.x"
|
||||
resourceX = "resource.xx"
|
||||
)
|
||||
|
||||
func TestSearchTagsV2(t *testing.T) {
|
@ -1,4 +1,4 @@
|
||||
package e2e
|
||||
package api
|
||||
|
||||
import (
|
||||
"compress/gzip"
|
||||
@ -17,7 +17,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
configCompression = "deployments/config-all-in-one-local.yaml"
|
||||
configCompression = "../deployments/config-all-in-one-local.yaml"
|
||||
)
|
||||
|
||||
func TestCompression(t *testing.T) {
|
@ -1,4 +1,4 @@
|
||||
package e2e
|
||||
package api
|
||||
|
||||
import (
|
||||
"testing"
|
@ -1,4 +1,4 @@
|
||||
package e2e
|
||||
package api
|
||||
|
||||
import (
|
||||
"context"
|
@ -1,4 +1,4 @@
|
||||
package e2e
|
||||
package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
@ -66,7 +66,8 @@ func testSearch(t *testing.T, tenant string, tenantSize int) {
|
||||
|
||||
require.NoError(t, util.CopyFileToSharedDir(s, configMultiTenant, "config.yaml"))
|
||||
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
|
||||
c, err := util.NewJaegerGRPCClient(tempo.Endpoint(14250))
|
@ -1,4 +1,4 @@
|
||||
package e2e
|
||||
package api
|
||||
|
||||
import (
|
||||
"context"
|
@ -1,4 +1,4 @@
|
||||
package e2e
|
||||
package api
|
||||
|
||||
import (
|
||||
"context"
|
@ -24,7 +24,6 @@ import (
|
||||
const (
|
||||
configMetricsGenerator = "config-metrics-generator.yaml"
|
||||
configMetricsGeneratorTargetInfo = "config-metrics-generator-targetinfo.yaml"
|
||||
prometheusImage = "prom/prometheus:latest"
|
||||
)
|
||||
|
||||
func TestMetricsGenerator(t *testing.T) {
|
||||
@ -36,7 +35,7 @@ func TestMetricsGenerator(t *testing.T) {
|
||||
tempoDistributor := util.NewTempoDistributor()
|
||||
tempoIngester := util.NewTempoIngester(1)
|
||||
tempoMetricsGenerator := util.NewTempoMetricsGenerator()
|
||||
prometheus := newPrometheus()
|
||||
prometheus := util.NewPrometheus()
|
||||
require.NoError(t, s.StartAndWaitReady(tempoDistributor, tempoIngester, tempoMetricsGenerator, prometheus))
|
||||
|
||||
// Wait until ingester and metrics-generator are active
|
||||
@ -225,7 +224,7 @@ func TestMetricsGeneratorTargetInfoEnabled(t *testing.T) {
|
||||
tempoDistributor := util.NewTempoDistributor()
|
||||
tempoIngester := util.NewTempoIngester(1)
|
||||
tempoMetricsGenerator := util.NewTempoMetricsGenerator()
|
||||
prometheus := newPrometheus()
|
||||
prometheus := util.NewPrometheus()
|
||||
require.NoError(t, s.StartAndWaitReady(tempoDistributor, tempoIngester, tempoMetricsGenerator, prometheus))
|
||||
|
||||
// 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"))
|
||||
}
|
||||
|
||||
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.
|
||||
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))
|
||||
|
@ -44,10 +44,11 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
image = "tempo:latest"
|
||||
debugImage = "tempo-debug:latest"
|
||||
queryImage = "tempo-query:latest"
|
||||
jaegerImage = "jaegertracing/jaeger-query:1.64.0"
|
||||
image = "tempo:latest"
|
||||
debugImage = "tempo-debug:latest"
|
||||
queryImage = "tempo-query:latest"
|
||||
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.
|
||||
@ -640,3 +641,13 @@ func SpanCount(a *tempopb.Trace) float64 {
|
||||
|
||||
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,
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user