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

(assertions): Annotations should support hasNoXxx() APIs #18874

Closed
1 of 2 tasks
fitzoh opened this issue Feb 8, 2022 · 2 comments · Fixed by #19330
Closed
1 of 2 tasks

(assertions): Annotations should support hasNoXxx() APIs #18874

fitzoh opened this issue Feb 8, 2022 · 2 comments · Fixed by #19330
Labels
@aws-cdk/assertions Related to the @aws-cdk/assertv2 package effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. good first issue Related to contributions. See CONTRIBUTING.md p2

Comments

@fitzoh
Copy link

fitzoh commented Feb 8, 2022

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 errors

I 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
@fitzoh fitzoh added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Feb 8, 2022
@github-actions github-actions bot added the @aws-cdk/assertions Related to the @aws-cdk/assertv2 package label Feb 8, 2022
@kaizencc
Copy link
Contributor

kaizencc commented Feb 8, 2022

This would be helpful. I agree the workaround is a bit awkward.

@kaizencc kaizencc removed their assignment Feb 8, 2022
@kaizencc kaizencc added effort/small Small work item – less than a day of effort p2 and removed needs-triage This issue or PR still needs to be triaged. labels Feb 8, 2022
@kaizencc kaizencc changed the title (assertions): add has_no_<error|warning_info>() methods (assertions): Annotations should support hasNoXxx() APIs Feb 8, 2022
@kaizencc kaizencc added the good first issue Related to contributions. See CONTRIBUTING.md label Feb 8, 2022
@mergify mergify bot closed this as completed in #19330 Mar 15, 2022
mergify bot pushed a commit that referenced this issue Mar 15, 2022
This PR adds `hasNoError`, `hasNoWarning`, and `hasNoInfo` methods to the Annotations assertions toolkit. 

Fixes #18874

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/assertions Related to the @aws-cdk/assertv2 package effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. good first issue Related to contributions. See CONTRIBUTING.md p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants