Skip to content

Commit

Permalink
Update query_frontend_test.go
Browse files Browse the repository at this point in the history
Updated labels to match the query

Signed-off-by: Pranav <[email protected]>
  • Loading branch information
pawarpranav83 authored Dec 21, 2023
1 parent 7062be4 commit f62850d
Showing 1 changed file with 12 additions and 23 deletions.
35 changes: 12 additions & 23 deletions test/e2e/query_frontend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,39 +47,28 @@ func TestQueryFrontend(t *testing.T) {

i := e2ethanos.NewReceiveBuilder(e, "ingestor").WithIngestionEnabled().Init()
testutil.Ok(t, e2e.StartAndWaitReady(i))

// prom, sidecar := e2ethanos.NewPrometheusWithSidecar(e, "1", e2ethanos.DefaultPromConfig("test", 0, "", "", e2ethanos.LocalPrometheusTarget), "", e2ethanos.DefaultPrometheusImage(), "")
// testutil.Ok(t, e2e.StartAndWaitReady(prom, sidecar))

// prom := e2ethanos.NewPrometheus(e, "1", e2ethanos.DefaultPromConfig("test", 0, e2ethanos.RemoteWriteEndpoint(i.InternalEndpoint("remote-write")), "", e2ethanos.LocalPrometheusTarget), "", e2ethanos.DefaultPrometheusImage())
// testutil.Ok(t, e2e.StartAndWaitReady(prom))

q := e2ethanos.NewQuerierBuilder(e, "1", i.InternalEndpoint("grpc")).Init()
testutil.Ok(t, e2e.StartAndWaitReady(q))

tsMillis := timestamp.FromTime(now)
var seriest []prompb.TimeSeries
metric1 := []prompb.Label{
{Name: "A", Value: "K6sjsNNczPl"},
{Name: labels.MetricName, Value: "fingerprint_collision"},
}
metric2 := []prompb.Label{
{Name: "A", Value: "cswpLMIZpwt"},
{Name: labels.MetricName, Value: "fingerprint_collision"},

var samplesrw []prompb.TimeSeries

metric := []prompb.Label{
{Name: "job", Value: "myself"},
{Name: "prometheus", Value: "test"},
{Name: "replica", Value: "0"},
{Name: "receive", Value: "receive-ingestor"},
{Name: "tenant_id", Value: "default-tenant"},
}

seriest = append(seriest, prompb.TimeSeries{
Labels: metric1,
samplesrw = append(samplesrw, prompb.TimeSeries{
Labels: metric,
Samples: []prompb.Sample{
{Value: float64(0), Timestamp: tsMillis},
},
})
seriest = append(seriest, prompb.TimeSeries{
Labels: metric2,
Samples: []prompb.Sample{
{Value: float64(1), Timestamp: tsMillis},
},
})

inMemoryCacheConfig := queryfrontend.CacheProviderConfig{
Type: queryfrontend.INMEMORY,
Expand All @@ -96,7 +85,7 @@ func TestQueryFrontend(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
t.Cleanup(cancel)

RemoteWrite(ctx, seriest, q.InternalEndpoint("http"))
RemoteWrite(ctx, samplesrw, q.InternalEndpoint("http"))

testutil.Ok(t, q.WaitSumMetricsWithOptions(e2emon.Equals(1), []string{"thanos_store_nodes_grpc_connections"}, e2emon.WaitMissingMetrics()))

Expand Down

0 comments on commit f62850d

Please sign in to comment.