Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unit tests after conflicting PRs merged #8393

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions pkg/frontend/querymiddleware/model_extra_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ func TestMetricQueryRequestCloneHeaders(t *testing.T) {

t.Run("WithID", func(t *testing.T) {
r := originalReq.WithID(1234)
require.NoError(t, err)

validateClonedHeaders(t, r.GetHeaders(), originalReq.GetHeaders())
})
t.Run("WithHeaders", func(t *testing.T) {
Expand All @@ -134,12 +132,10 @@ func TestMetricQueryRequestCloneHeaders(t *testing.T) {
}

r := originalReq.WithHeaders(newHeaders)
require.NoError(t, err)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to reviewers: removed such assertions because they're useless (the line above is not returning an error and err variable is already checked)

pracucci marked this conversation as resolved.
Show resolved Hide resolved

validateClonedHeaders(t, r.GetHeaders(), newHeaders)
})
t.Run("WithStartEnd", func(t *testing.T) {
r := originalReq.WithStartEnd(100, 200)
r, err := originalReq.WithStartEnd(100, 200)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to reviewers: this is the actual fix.

require.NoError(t, err)

validateClonedHeaders(t, r.GetHeaders(), originalReq.GetHeaders())
Expand All @@ -152,20 +148,14 @@ func TestMetricQueryRequestCloneHeaders(t *testing.T) {
})
t.Run("WithTotalQueriesHint", func(t *testing.T) {
r := originalReq.WithTotalQueriesHint(10)
require.NoError(t, err)

validateClonedHeaders(t, r.GetHeaders(), originalReq.GetHeaders())
})
t.Run("WithExpr", func(t *testing.T) {
r := originalReq.WithExpr(nil)
require.NoError(t, err)

validateClonedHeaders(t, r.GetHeaders(), originalReq.GetHeaders())
})
t.Run("WithEstimatedSeriesCountHint", func(t *testing.T) {
r := originalReq.WithEstimatedSeriesCountHint(10)
require.NoError(t, err)

validateClonedHeaders(t, r.GetHeaders(), originalReq.GetHeaders())
})
})
Expand Down
Loading