-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
feat(assertions): major improvements to the capture feature #17713
Conversation
When there are multiple targets (say, Resource in the CloudFormation template) that matches the given condition, any `Capture` defined in the condition will contain only the last matched resource. Convert the `Capture` class into an iterable so all matching values can be retrieved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks sensible. I wonder if we could do some research to figure out how other pattern do it, if there's a clever coding pattern we might have missed.
But otherwise, yeah this seems to get the job done.
return this; | ||
} | ||
|
||
/** | ||
* Prepare the result to be analyzed. | ||
* Analyzing results before the finalize() API is called may be inaccurate in some cases. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a weak statement. Should be made stronger (it's not allowed to analyze results before calling this?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to get hasFailed()
etc on this having been called first?
So that it cannot be misused?
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
There are three major changes around the capture feature of assertions. Firstly, when there are multiple targets (say, Resource in the CloudFormation template) that matches the given condition, any `Capture` defined in the condition will contain only the last matched resource. Convert the `Capture` class into an iterable so all matching values can be retrieved. Secondly, add support to allow sub-patterns to be specified to the `Capture` class. This allows further conditions be specified, via Matchers or literals, when a value is to be captured. Finally, this fixes a bug with the current implementation where `Capture` contains the results of the last matched section, irrespective of whether that section matched with the rest of the matcher or not. fixes aws#17009 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
There are three major changes around the capture feature of assertions.
Firstly, when there are multiple targets (say, Resource in the
CloudFormation template) that matches the given condition, any
Capture
defined in the condition will contain only the last matchedresource.
Convert the
Capture
class into an iterable so all matching values canbe retrieved.
Secondly, add support to allow sub-patterns to be specified to the
Capture
class. This allows further conditions be specified, viaMatchers or literals, when a value is to be captured.
Finally, this fixes a bug with the current implementation where
Capture
contains the results of the last matched section, irrespectiveof whether that section matched with the rest of the matcher or not.
fixes #17009
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license