Skip to content

Commit

Permalink
refactor test helper function
Browse files Browse the repository at this point in the history
Signed-off-by: Ahmed Hassan <afayekhassan@gmail.com>
  • Loading branch information
afhassan committed Sep 26, 2024
1 parent dd338d1 commit a9a8a62
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
7 changes: 7 additions & 0 deletions pkg/querier/tripperware/queryrange/query_range_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"context"
"io"
"net/http"
"sort"
"strconv"
"testing"

Expand All @@ -23,6 +24,12 @@ import (
"github.com/cortexproject/cortex/pkg/querier/tripperware"
)

func sortPrometheusResponseHeader(headers []*tripperware.PrometheusResponseHeader) {
sort.Slice(headers, func(i, j int) bool {
return headers[i].Name < headers[j].Name
})
}

func TestRequest(t *testing.T) {
t.Parallel()
// Create a Copy parsedRequest to assign the expected headers to the request without affecting other tests using the global.
Expand Down
7 changes: 0 additions & 7 deletions pkg/querier/tripperware/queryrange/results_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"fmt"
"net/http"
"sort"
"strconv"
"testing"
"time"
Expand Down Expand Up @@ -150,12 +149,6 @@ var (
}
)

func sortPrometheusResponseHeader(headers []*tripperware.PrometheusResponseHeader) {
sort.Slice(headers, func(i, j int) bool {
return headers[i].Name < headers[j].Name
})
}

func mkAPIResponse(start, end, step int64) tripperware.Response {
return mkAPIResponseWithStats(start, end, step, false, false)
}
Expand Down

0 comments on commit a9a8a62

Please sign in to comment.