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

fix(assert): Adjust assertion behavior to be stricter #1289

Merged
merged 4 commits into from
Dec 6, 2018

Conversation

RomainMuller
Copy link
Contributor

@RomainMuller RomainMuller commented Dec 5, 2018

The SUPERSET matching mode would have aborted successfully upon finding
the first acceptable change (a change that is a CREATE), and not look at
subsequent changes, hence allowing any other type of update to pass as
long as it is detected later in the template. This change fixes that such that the
assertion will reject upon any change that is NOT a CREATE change.

Additionally, the default behavior of the haveResource matcher was changed
to not allow additional values in objects below the root of the expectation, which
makes it harder to write tests that inadvertently allow excessive IAM policies or
network security settings (amounts other things) to pass when the user intention
was for them to fail.

BREAKING CHANGE: the behavior change of haveResource can cause tests to
fail. If allowing extension of the expected values is the intended behavior, you can
switch to the haveResourceLike matcher instead, which exposes the previous
behavior.

Fixes awslabs/cdk-ops#186


Pull Request Checklist

Please check all boxes, including N/A items:

Testing

  • Unit test and/or integration test added
  • Toolkit change?: integration tests manually executed (paste output to the PR description)
  • Init template change?: coordinated update of integration tests (currently maintained in a private repo).

Documentation

  • README: README and/or documentation topic updated
  • jsdocs: All public APIs documented

Title and description

  • Change type: Title is prefixed with change type:
    • fix(module): <title> bug fix (patch)
    • feat(module): <title> feature/capability (minor)
    • chore(module): <title> won't appear in changelog
    • build(module): <title> won't appear in changelog
  • Title format: Title uses lower case and doesn't end with a period
  • Breaking change?: Last paragraph of description is: BREAKING CHANGE: <describe exactly what changed and how to achieve similar behavior + link to documentation/gist/issue if more details are required>
  • References: Indicate issues fixed via: Fixes #xxx or Closes #xxx

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license.

The SUPERSET matching mode would have aborted successfully upon finding
the first acceptable change (a change that is a CREATE), and not look at
subsequent changes, hence allowing any other type of update to pass as
long as it is detected later in the template.

This change fixes that such that the assertion will reject upon any
change that is NOT a CREATE change.

Fixes awslabs/cdk-ops#186
…ditional keys at the root, but the values for expected keys must match exactly)
@RomainMuller RomainMuller changed the title fix(assert): Correct bug in SUPERSET matching fix(assert): Adjust assertion behavior to be stricter Dec 6, 2018
@RomainMuller RomainMuller merged commit 0919bf4 into master Dec 6, 2018
@RomainMuller RomainMuller deleted the rmuller/assertions branch December 6, 2018 09:03
@NGL321 NGL321 added the contribution/core This is a PR that came from AWS. label Sep 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants