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

Fail benchmark if assertion could not run #1588

Merged
merged 6 commits into from
Nov 2, 2022

Conversation

pquentin
Copy link
Member

When you 1/ enable assertions and 2/ have assertions in your track but 3/ the operation is returning an unsupported type, we used to only issue a debug log! I believe that we should instead complain loudly. This is technically breaking but will only report valid issues so I think it makes sense to include in the next minor version of Rally.

This was initially reported by @ywelsch in #1582 (comment).

@pquentin pquentin added enhancement Improves the status quo :Usability Makes Rally easier to use labels Sep 27, 2022
@pquentin pquentin added this to the 2.x milestone Sep 27, 2022
@pquentin pquentin self-assigned this Sep 27, 2022
Copy link
Contributor

@ywelsch ywelsch left a comment

Choose a reason for hiding this comment

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

Thanks for picking this up.

Copy link
Contributor

@DJRickyB DJRickyB left a comment

Choose a reason for hiding this comment

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

LGTM. This feels like it's not just sensible but correct, and I'm glad you've addressed it; agree it should go in the next minor

@@ -404,7 +404,7 @@ async def __call__(self, *args):
props = parse(return_value, assertion["property"])
self.check_assertion(op_name, assertion, props, props_expand_keys=False)
else:
self.logger.debug("Skipping assertion check in [%s] as [%s] does not return a dict.", op_name, repr(self.delegate))
raise exceptions.DataError(f"Cannot check assertion in [{op_name}] as [{repr(self.delegate)}] does not return a dict.")
Copy link
Contributor

Choose a reason for hiding this comment

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

The only nit I have here is that perhaps this could say did not return a dict, as it could be that the operation typically returns a valid parseable response, but in this instance returned a stacktrace or something

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, I fixed that. Well it could also return JSON encoded as bytes in a BytesIO but I did not want to overcomplicate the error message.

Like the json module from the standard library, ijson expect bytes.
While the signature of `parse()` is type hinted correctly, types are not
enforced and many tests were passing a StringIO instance incorrectly.
This produced deprecation warnings locally, but not on CI for unknown
reasons.
@pquentin pquentin modified the milestones: 2.x, 2.7.0 Nov 2, 2022
@pquentin pquentin merged commit 557bed9 into elastic:master Nov 2, 2022
@pquentin pquentin deleted the raise-on-assertion-check-failure branch February 16, 2023 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improves the status quo :Usability Makes Rally easier to use
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants