Skip to content

Commit

Permalink
add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
yuchen-db committed May 18, 2024
1 parent 9c40382 commit b6336d8
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions internal/cortex/querier/queryrange/query_bytes_fetched_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (c) The Cortex Authors.
// Licensed under the Apache License 2.0.

package queryrange

import (
"testing"

"github.com/stretchr/testify/require"
)

func TestQueryBytesFetchedPrometheusResponseHeaders(t *testing.T) {
resp1 := PrometheusResponse{Headers: []*PrometheusResponseHeader{&PrometheusResponseHeader{Name: "M3-Fetched-Bytes-Estimate", Values: []string{"100"}}}}
resp2 := PrometheusResponse{Headers: []*PrometheusResponseHeader{&PrometheusResponseHeader{Name: "M3-Fetched-Bytes-Estimate", Values: []string{"1000"}}}}
resp3 := PrometheusResponse{}
hdrs := QueryBytesFetchedPrometheusResponseHeaders(&resp1, &resp2, &resp3)
expected := []*PrometheusResponseHeader{{Name: QueryBytesFetchedHeaderName,
Values: []string{"1100"}}}
require.Equal(t, hdrs, expected)
}

0 comments on commit b6336d8

Please sign in to comment.