Skip to content

(assertions): Add Template.resourcePropertiesCountIs() method #21706

@ddneilson

Description

@ddneilson

Describe the feature

I am requesting creation of a Template.resourcePropertiesCountIs() method to compliment Template.resourceCountIs() in the same way that Template.hasResourceProperties() complements Template.hasResource().

This is a function that asserts that the number of resources in the Template of a given type and that match specified resource properties is equal to a given count.

Use Case

I recently migrated the AWS RFDK from CDKv1 to CDKv2. Many of our tests involve counting the number of Resources with a specific set of properties, but the new testing module for the CDK does not cover the use-case.
I ended up creating a helper in the RFDK to help with our migration, but I think that the functionality would be more useful to the general community.

Proposed Solution

I have a PR prepped and will be posting it momentarily.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.38.1

Environment details (OS name and version, etc.)

All

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/assertionsRelated to the @aws-cdk/assertv2 packageeffort/smallSmall work item – less than a day of effortfeature-requestA feature should be added or improved.in-progressThis issue is being actively worked on.p2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions