Files
Joe ElliottandGitHub 5ee93d3cf8 Tempo 3.0: Integration Tests Rewrite (#6088)
* First pass test harness

Signed-off-by: Joe Elliott <[email protected]>

* limits - passed

Signed-off-by: Joe Elliott <[email protected]>

* metrics generator - passed

Signed-off-by: Joe Elliott <[email protected]>

* harness cleanup/fix target info test

Signed-off-by: Joe Elliott <[email protected]>

* deployments - passed

Signed-off-by: Joe Elliott <[email protected]>

* receivers - passed

Signed-off-by: Joe Elliott <[email protected]>

* harness cleanup

Signed-off-by: Joe Elliott <[email protected]>

* storage - passed

Signed-off-by: Joe Elliott <[email protected]>

* api - passing

Signed-off-by: Joe Elliott <[email protected]>

* cleanup and CI

Signed-off-by: Joe Elliott <[email protected]>

* Additional tests

Signed-off-by: Joe Elliott <[email protected]>

* it's me and you linter. how many times are you going to do this to me?

Signed-off-by: Joe Elliott <[email protected]>

* lint and tests

Signed-off-by: Joe Elliott <[email protected]>

* restored live store partition tests

Signed-off-by: Joe Elliott <[email protected]>

* massive lint

Signed-off-by: Joe Elliott <[email protected]>

* cleanup

Signed-off-by: Joe Elliott <[email protected]>

* lint >.<

Signed-off-by: Joe Elliott <[email protected]>

* wups

Signed-off-by: Joe Elliott <[email protected]>

* cleanup and stabilizing

Signed-off-by: Joe Elliott <[email protected]>

* cleanup

Signed-off-by: Joe Elliott <[email protected]>

* omg

Signed-off-by: Joe Elliott <[email protected]>

* added config file. removed empty file. deleted some debug code

Signed-off-by: Joe Elliott <[email protected]>

* even more fixes

Signed-off-by: Joe Elliott <[email protected]>

* maybe this works? maybe it was all local networking issues

Signed-off-by: Joe Elliott <[email protected]>

* review

Signed-off-by: Joe Elliott <[email protected]>

* backed off huge write timeout. added missing config file

Signed-off-by: Joe Elliott <[email protected]>

* restore disable parallelism setting. restore beefy write timeout

Signed-off-by: Joe Elliott <[email protected]>

* apparently another test relied on the http receiver

Signed-off-by: Joe Elliott <[email protected]>

* livestore avail zone!

Signed-off-by: Joe Elliott <[email protected]>

* add support for v1 traces and tags endpoints

Signed-off-by: Joe Elliott <[email protected]>

* review

Signed-off-by: Joe Elliott <[email protected]>

* changed the location of the changelog entry to avoid conflicts

Signed-off-by: Joe Elliott <[email protected]>

---------

Signed-off-by: Joe Elliott <[email protected]>
2026-01-07 08:31:11 -05:00

104 lines
2.8 KiB
Go

package deployments
import (
"fmt"
"testing"
"time"
"github.com/grafana/e2e"
e2edb "github.com/grafana/e2e/db"
"github.com/grafana/tempo/integration/util"
tempoUtil "github.com/grafana/tempo/pkg/util"
"github.com/prometheus/prometheus/model/labels"
"github.com/stretchr/testify/require"
)
const configKVStore = "config-kvstore.yaml"
func TestKVStores(t *testing.T) {
testKVStores := []struct {
name string
setupKVStore func(*e2e.Scenario, map[string]any) error
kvstoreConfig string
}{
{
name: "memberlist",
setupKVStore: func(_ *e2e.Scenario, templateData map[string]any) error {
templateData["KVStoreConfig"] = `
store: memberlist`
return nil
},
},
{
name: "etcd",
setupKVStore: func(s *e2e.Scenario, templateData map[string]any) error {
etcd := e2edb.NewETCD()
if err := s.StartAndWaitReady(etcd); err != nil {
return err
}
templateData["KVStoreConfig"] = fmt.Sprintf(`
store: etcd
etcd:
endpoints:
- http://%s:%d`, etcd.Name(), etcd.HTTPPort())
return nil
},
},
{
name: "consul",
setupKVStore: func(s *e2e.Scenario, templateData map[string]any) error {
consul := e2edb.NewConsul()
if err := s.StartAndWaitReady(consul); err != nil {
return err
}
templateData["KVStoreConfig"] = fmt.Sprintf(`
store: consul
consul:
host: http://%s:%d`, consul.Name(), consul.HTTPPort())
return nil
},
},
}
for _, tc := range testKVStores {
t.Run(tc.name, func(t *testing.T) {
util.RunIntegrationTests(t, util.TestHarnessConfig{
ConfigOverlay: configKVStore,
PreStartHook: tc.setupKVStore,
}, func(h *util.TempoHarness) {
h.WaitTracesWritable(t)
liveStoreA := h.Services[util.ServiceLiveStoreZoneA]
liveStoreB := h.Services[util.ServiceLiveStoreZoneB]
matchers := []*labels.Matcher{
{Type: labels.MatchEqual, Name: "state", Value: "ACTIVE"},
{Type: labels.MatchEqual, Name: "name", Value: "live-store"},
}
require.NoError(t, liveStoreA.WaitSumMetricsWithOptions(
e2e.Equals(float64(2)),
[]string{"tempo_ring_members"},
e2e.WithLabelMatchers(matchers...),
), "live stores failed to join ring with %s", tc.name)
require.NoError(t, liveStoreB.WaitSumMetricsWithOptions(
e2e.Equals(float64(2)),
[]string{"tempo_ring_members"},
e2e.WithLabelMatchers(matchers...),
), "live stores failed to join ring with %s", tc.name)
// Send a trace
info := tempoUtil.NewTraceInfo(time.Now(), "")
require.NoError(t, h.WriteTraceInfo(info, ""))
// Wait for trace to be created in live stores
h.WaitTracesQueryable(t, 1)
// Find trace
apiClient := h.APIClientHTTP("")
util.QueryAndAssertTrace(t, apiClient, info)
util.SearchTraceQLAndAssertTrace(t, apiClient, info)
})
})
}
}