aws / aws/aws-cdk

(integ-runner): (assertions on object keys)

Open
#33,068 2 comments 0 reactions 0 assignees View on GitHub
@aws-cdk/integ-runner effort/medium feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the feature

Allow assertions about the keys contained in an API call response. ExpectedResults that contain generated data. Currently, only full matching is supported.

### Use Case

One example - Writing a custom provider that generates a set of secret values and stores it in a secretsmanager secret as a JSON object. It's impossible to match the complete object since the secrets are generated by the custom provider. A partial match on the object (e.g. verifying a particular key exists) would be sufficient to verify the behavior of the provider.

### Proposed Solution

In the [base assertions](https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk.assertions/README.html#presence-and-absence) module, this can be accomplished using `Match.absent()` and `Match.any_value()`. Adding comparable methods for integration test assertions seems like a reasonable implementation.

Beyond that, adding the ability to match an object value by regex would allow for greater specificity in one's assertions.

### Other Information

_No response_

### Acknowledgements

- [x] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

### CDK version used

2.174.0

### Environment details (OS name and version, etc.)

MacOS 15.2

Contributor guide

Open the contributing guide

Research direction

Start by locating the integration-runner assertion implementation and compare it with the base assertions module, especially Match.absent() and Match.any_value(). Define how partial object-key matching and regex value matching should behave, then run the existing integration assertion tests and add coverage showing generated object fields can be asserted without full matching.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.