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

feat(assertions): an initial version of the CDK 'assert' library, now experimentally available in all supported languages #14952

Merged
merged 23 commits into from
Jun 16, 2021

Conversation

nija-at
Copy link
Contributor

@nija-at nija-at commented Jun 2, 2021

Announcing 'assertions', the next revision of the CDK assert
module. This module is built via jsii and hence is available in
all CDK supported languages.

Motivation and design: https://github.com/aws/aws-cdk-rfcs/blob/master/text/0328-polyglot-assert.md


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

@gitpod-io
Copy link

gitpod-io bot commented Jun 2, 2021

@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Jun 2, 2021
@peterwoodworth peterwoodworth added the @aws-cdk/assertions Related to the @aws-cdk/assertv2 package label Jun 3, 2021
@nija-at nija-at force-pushed the nija-at/assertv2 branch from dff0f30 to 29e0dda Compare June 10, 2021 15:54
@nija-at nija-at changed the title feat: announcing assertv2: run assertions against the synthesized template in all cdk supported languages feat: announcing assertions: the CDK 'assert' library is now available in all supported languages Jun 10, 2021
@nija-at nija-at marked this pull request as ready for review June 10, 2021 15:55
@nija-at nija-at requested a review from a team June 10, 2021 15:55
@nija-at nija-at force-pushed the nija-at/assertv2 branch from 2766055 to c656b29 Compare June 10, 2021 16:41
@nija-at nija-at marked this pull request as draft June 10, 2021 16:42
@nija-at nija-at marked this pull request as ready for review June 11, 2021 12:57
eladb
eladb previously requested changes Jun 13, 2021
packages/@aws-cdk/assertions/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/assertions/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/assertions/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/assertions/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/assertions/README.md Outdated Show resolved Hide resolved
}
}

function toTemplate(stack: Stack): any {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As commented in the RFC, I believe we may want to expose this method directly to support snapshot tests:

expect(Template.fromStack(stack)).toMatchSnapshot();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add this in, as we need it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean "as we need it"? The use case is clear and almost every construct library I've written used snapshot tests to some degree. The current assert library as "SynthUtils" which offer this api, which implies "we already need it". No?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll be migrating more construct libraries to use 'assertions'. This PR only migrates efs. I'll add it when I come across one.

Niranjan Jayakar and others added 2 commits June 14, 2021 11:22
@nija-at nija-at requested a review from eladb June 14, 2021 10:25
* Typically used, as part of unit tests, to validate that the rendered
* CloudFormation template has expected resources and properties.
*/
export class TemplateAssertions {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slight preference for Assertions here (shorter name, easier to read and type). But I guess potato potato.

@rix0rrr rix0rrr changed the title feat: announcing assertions: the CDK 'assert' library is now available in all supported languages feat(assertions): the CDK 'assert' library, now available in all supported languages Jun 15, 2021
@rix0rrr rix0rrr added the pr/do-not-merge This PR should not be merged at this time. label Jun 15, 2021
@rix0rrr rix0rrr changed the title feat(assertions): the CDK 'assert' library, now available in all supported languages feat(assertions): the CDK 'assert' library, now experimentally available in all supported languages Jun 15, 2021
@nija-at nija-at changed the title feat(assertions): the CDK 'assert' library, now experimentally available in all supported languages feat(assertions): an initial version of the CDK 'assert' library, now experimentally available in all supported languages Jun 15, 2021
@nija-at nija-at removed the pr/do-not-merge This PR should not be merged at this time. label Jun 15, 2021
@nija-at nija-at force-pushed the nija-at/assertv2 branch from ac9763e to 67af532 Compare June 16, 2021 07:16
@nija-at nija-at dismissed eladb’s stale review June 16, 2021 07:25

Addressed

@mergify
Copy link
Contributor

mergify bot commented Jun 16, 2021

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-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: 0e851e2
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@rix0rrr
Copy link
Contributor

rix0rrr commented Jun 16, 2021

@Mergifyio refresh

@nija-at nija-at merged commit a23aa63 into master Jun 16, 2021
@nija-at nija-at deleted the nija-at/assertv2 branch June 16, 2021 16:27
MrArnoldPalmer added a commit that referenced this pull request Jun 16, 2021
…ary, now experimentally available in all supported languages (#14952)

Refs: a23aa63
MrArnoldPalmer added a commit that referenced this pull request Jun 16, 2021
…ary, now experimentally available in all supported languages (#14952) (#15163)

Refs: a23aa63
@nija-at nija-at restored the nija-at/assertv2 branch June 17, 2021 13:42
matthewsvu pushed a commit to matthewsvu/aws-cdk that referenced this pull request Jun 22, 2021
…w experimentally available in all supported languages (aws#14952)

Announcing 'assertions', the next revision of the CDK assert
module. This module is built via jsii and hence is available in
all CDK supported languages.

Motivation and design: https://github.com/aws/aws-cdk-rfcs/blob/master/text/0328-polyglot-assert.md
matthewsvu pushed a commit to matthewsvu/aws-cdk that referenced this pull request Jun 22, 2021
…ary, now experimentally available in all supported languages (aws#14952) (aws#15163)

Refs: a23aa63
hollanddd pushed a commit to hollanddd/aws-cdk that referenced this pull request Aug 26, 2021
…w experimentally available in all supported languages (aws#14952)

Announcing 'assertions', the next revision of the CDK assert
module. This module is built via jsii and hence is available in
all CDK supported languages.

Motivation and design: https://github.com/aws/aws-cdk-rfcs/blob/master/text/0328-polyglot-assert.md
hollanddd pushed a commit to hollanddd/aws-cdk that referenced this pull request Aug 26, 2021
…ary, now experimentally available in all supported languages (aws#14952) (aws#15163)

Refs: a23aa63
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/assertions Related to the @aws-cdk/assertv2 package contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants