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

Chore: add instant query to query-frontend limitsMiddleware tests #8410

Merged
merged 2 commits into from
Jun 19, 2024

Conversation

pracucci
Copy link
Collaborator

What this PR does

While working on #8374 we noticed that we don't test limitsMiddleware against instant queries. In this PR I'm doing it. Specifically:

  • TestLimitsMiddleware_MaxQueryLookback: create a new TestLimitsMiddleware_MaxQueryLookback_InstantQuery because the assertions for instant queries are different than range queries and remote reads
  • TestLimitsMiddleware_MaxQueryExpressionSizeBytes: added instant queries
  • TestLimitsMiddleware_MaxQueryLength: doesn't apply to instant queries because we run the check against the input query time range (and instant queries don't have a time range)

Which issue(s) this PR fixes or relates to

N/A

Checklist

  • Tests updated.
  • Documentation added.
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX].
  • about-versioning.md updated with experimental features.

@pracucci pracucci requested a review from krajorama June 18, 2024 10:30
@pracucci pracucci marked this pull request as ready for review June 18, 2024 10:30
@pracucci pracucci requested a review from a team as a code owner June 18, 2024 10:30
Copy link
Contributor

@krajorama krajorama left a comment

Choose a reason for hiding this comment

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

Let's also add

				"instant query": &PrometheusInstantQueryRequest{
					queryExpr: parseQuery(t, testData.query),
					time:      endMs,
				},

to TestLimitsMiddleware_MaxQueryExpressionSizeBytes

expectedSkipped bool
expectedTime time.Time
}{
"should not manipulate request time if maxQueryLookback and blocksRetentionPeriod are both disabled": {
Copy link
Contributor

Choose a reason for hiding this comment

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

NitX3: If I understand correctly, start==end for instant query so either we allow it or not, never manipulate it so this is kind of weird name for the testcase.

Suggested change
"should not manipulate request time if maxQueryLookback and blocksRetentionPeriod are both disabled": {
"should allow executing a request if maxQueryLookback and blocksRetentionPeriod are both disabled": {

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, absolutely. Going to fix the descriptions in this test.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done in 7fac981

Copy link
Contributor

@krajorama krajorama left a comment

Choose a reason for hiding this comment

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

approved with nit

Signed-off-by: Marco Pracucci <[email protected]>
@pracucci pracucci force-pushed the test-instant-query-limits branch from 96c150c to 7fac981 Compare June 19, 2024 09:46
@pracucci pracucci enabled auto-merge (squash) June 19, 2024 09:46
@pracucci pracucci merged commit d0f6e99 into main Jun 19, 2024
29 checks passed
@pracucci pracucci deleted the test-instant-query-limits branch June 19, 2024 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants