-
Notifications
You must be signed in to change notification settings - Fork 4.5k
(assertions): Annotations should support hasNoXxx() APIs #18874
Copy link
Copy link
Closed
Labels
@aws-cdk/assertionsRelated to the @aws-cdk/assertv2 packageRelated to the @aws-cdk/assertv2 packageeffort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortfeature-requestA feature should be added or improved.A feature should be added or improved.good first issueRelated to contributions. See CONTRIBUTING.mdRelated to contributions. See CONTRIBUTING.mdp2
Description
Description
Add has_no_error, has_no_warning, and has_no_info methods to the Annotations assertions toolkit.
Use Case
I'm testing some EC2 constructs and lettings users pass in block volumes, adding errors if any volumes are unencrypted.
The test for something that produces an error is easy:
Annotations.from_stack(stack).has_error("*", "unencrypted volume /dev/sda1")The test for a value that doesn't produce an error is awkward:
errors = Annotations.from_stack(stack).find_error(
"*", Match.string_like_regexp(".*")
)
assert not errorsI would like to easily assert that there are no errors in the stack
Proposed Solution
Add a has_no_error method next to the has_error and find_error methods (as well as info and warning variants).
Other information
No response
Acknowledge
- I may be able to implement this feature request
- This feature might incur a breaking change
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
@aws-cdk/assertionsRelated to the @aws-cdk/assertv2 packageRelated to the @aws-cdk/assertv2 packageeffort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortfeature-requestA feature should be added or improved.A feature should be added or improved.good first issueRelated to contributions. See CONTRIBUTING.mdRelated to contributions. See CONTRIBUTING.mdp2