From 6a7a9c5769b9808d85b47fc18fb5562ac5c41e13 Mon Sep 17 00:00:00 2001 From: pawarpranav83 Date: Sun, 24 Dec 2023 15:57:54 +0530 Subject: [PATCH] Updaeted query_frontend_test -- Added sample metric, and the remoteWrite function call Signed-off-by: pawarpranav83 --- test/e2e/query_frontend_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/e2e/query_frontend_test.go b/test/e2e/query_frontend_test.go index 57d94d02f1f..0720be7f48f 100644 --- a/test/e2e/query_frontend_test.go +++ b/test/e2e/query_frontend_test.go @@ -449,6 +449,25 @@ func TestQueryFrontendMemcachedCache(t *testing.T) { q := e2ethanos.NewQuerierBuilder(e, "1", i.InternalEndpoint("grpc")).Init() testutil.Ok(t, e2e.StartAndWaitReady(q)) + tsMillis := timestamp.FromTime(now) + + var samplesrw []prompb.TimeSeries + + metric := []prompb.Label{ + {Name: "__name__", Value: "up"}, + {Name: "instance", Value: "localhost:9090"}, + {Name: "job", Value: "myself"}, + {Name: "prometheus", Value: "test"}, + {Name: "replica", Value: "0"}, + } + + samplesrw = append(samplesrw, prompb.TimeSeries{ + Labels: metric, + Samples: []prompb.Sample{ + {Value: float64(0), Timestamp: tsMillis}, + }, + }) + memcached := e2ethanos.NewMemcached(e, "1") testutil.Ok(t, e2e.StartAndWaitReady(memcached)) @@ -475,6 +494,8 @@ func TestQueryFrontendMemcachedCache(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), time.Minute) t.Cleanup(cancel) + testutil.Ok(t, remoteWrite(ctx, samplesrw, i.Endpoint("remote-write"))) + testutil.Ok(t, q.WaitSumMetricsWithOptions(e2emon.Equals(1), []string{"thanos_store_nodes_grpc_connections"}, e2emon.WaitMissingMetrics())) testutil.Ok(t, queryFrontend.WaitSumMetrics(e2emon.Equals(1), "cortex_memcache_client_servers"))