(assertions): match properties against *all* resources of a given type #21269
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.
p2
Describe the feature
Given a Stack with resources of the same type (e.g.,
AWS::S3::Bucket
), easily apply assertions against all of those resources.Currently,
has_resource_properties()
(and similar methods) returnsTrue
if a single resource matches, even if other resources don't match.Use Case
Given a stack with two S3 Buckets:
When a
has_resource_properties
assertion is run againstAWS::S3::Bucket
resources:Then the test will fail, as only one of the Buckets has SSE enabled. As is implemented now, the test passes.
Proposed Solution
has_resource_properties(match_all_resources=True)
, such that all resources of a given type must match theprops
, else it will returnFalse
.has_resources_properties()
that applies to all resources of a given type.Also:
has_resource_properties
(and similar methods) will returnTrue
if a single match is found.Other Information
cc: @mrgrain
Acknowledgements
CDK version used
2.33.0
Environment details (OS name and version, etc.)
MacOS 11.6.7
The text was updated successfully, but these errors were encountered: