Skip to content

Commit b6336d8

Browse files
committed
add unit test
1 parent 9c40382 commit b6336d8

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright (c) The Cortex Authors.
2+
// Licensed under the Apache License 2.0.
3+
4+
package queryrange
5+
6+
import (
7+
"testing"
8+
9+
"github.com/stretchr/testify/require"
10+
)
11+
12+
func TestQueryBytesFetchedPrometheusResponseHeaders(t *testing.T) {
13+
resp1 := PrometheusResponse{Headers: []*PrometheusResponseHeader{&PrometheusResponseHeader{Name: "M3-Fetched-Bytes-Estimate", Values: []string{"100"}}}}
14+
resp2 := PrometheusResponse{Headers: []*PrometheusResponseHeader{&PrometheusResponseHeader{Name: "M3-Fetched-Bytes-Estimate", Values: []string{"1000"}}}}
15+
resp3 := PrometheusResponse{}
16+
hdrs := QueryBytesFetchedPrometheusResponseHeaders(&resp1, &resp2, &resp3)
17+
expected := []*PrometheusResponseHeader{{Name: QueryBytesFetchedHeaderName,
18+
Values: []string{"1100"}}}
19+
require.Equal(t, hdrs, expected)
20+
}

0 commit comments

Comments
 (0)