Skip to content

Commit

Permalink
Updaeted query_frontend_test
Browse files Browse the repository at this point in the history
    -- Added sample metric, and the remoteWrite function call

Signed-off-by: pawarpranav83 <[email protected]>
  • Loading branch information
pawarpranav83 committed Dec 24, 2023
1 parent 2d1a9fe commit 6a7a9c5
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/e2e/query_frontend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand All @@ -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"))
Expand Down

0 comments on commit 6a7a9c5

Please sign in to comment.