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

Add parity tests and refactor logic for CFn stack resource updates #6780

Merged
merged 3 commits into from
Aug 30, 2022

Conversation

whummer
Copy link
Member

@whummer whummer commented Aug 30, 2022

Add parity tests and add a number of smaller fixes in the logic for CloudFormation stack resource updates. Addresses #6155

The main issue with the sample shared by the user is that SAM deployment was hanging, as the stack/resource status was incorrectly reported as CREATE_COMPLETE instead of UPDATE_COMPLETE. This led to the discovery of a few more issues, which are now fixed, and covered by parity tests.

Summary of changes:

  • properly set the status of stack resources as CREATE_COMPLETE or UPDATE_COMPLETE, depending on the operation and prior existence of resources within the stack
  • add a parity/snapshot test for the point above (which is essentially what caused SAM/samlocal to hang when deploying the sample in samlocal not returning on second and later deploys #6155)
  • ensure that Parameter instances are not being returned from the list of stack resources in DescribeStackResources
  • remove a few attributes in API response messages to avoid ASF response serializer warnings
  • minor simplifications, e.g., removing stack_name from apply_changes(..) method
  • add missing resource methods to CDK::Metadata model, returning synthetic data (surfaced as being required when testing the changes)
  • fix an assertion in test_cfn_with_multiple_route_tables and parity test it against AWS - previously we were creating/asserting 3 route tables instead of 4 (validated against AWS)

Note: part of the changes in the PR is to avoid us changing the resource action (from "Modify" to "Add"), and instead introducing a "_deployed" attribute that allows us to determine whether the resource needs to be created or updated - see TODO in the code. This is only a workaround for now, and should be fixed as part of a larger refactoring after introducing model classes for the state of the resources in a stack (e.g., using a cached property). To be discussed in more detail @dominikschubert ... 👍

@whummer whummer temporarily deployed to localstack-ext-tests August 30, 2022 07:40 Inactive
@whummer whummer changed the title Add parity tests and refactor logic for stack resource updates Add parity tests and refactor logic for CFn stack resource updates Aug 30, 2022
@github-actions
Copy link

github-actions bot commented Aug 30, 2022

LocalStack integration with Pro

       3 files  ±0         3 suites  ±0   1h 10m 41s ⏱️ - 8m 7s
1 240 tests +1  1 199 ✔️ +2  41 💤  - 1  0 ±0 
1 665 runs  +1  1 593 ✔️ +2  72 💤  - 1  0 ±0 

Results for commit 97a2027. ± Comparison against base commit 31286eb.

♻️ This comment has been updated with latest results.

@whummer whummer temporarily deployed to localstack-ext-tests August 30, 2022 09:11 Inactive
@whummer whummer temporarily deployed to localstack-ext-tests August 30, 2022 09:45 Inactive
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.02%) to 91.563% when pulling 97a2027 on cfn-parity-stack-updates into 31286eb on master.

Copy link
Member

@dominikschubert dominikschubert left a comment

Choose a reason for hiding this comment

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

LGTM 👍

The workaround is fine for me for now. As you've said, this will be changed/removed at a later point anyway.

Parity 🚀 🚀

@whummer whummer merged commit 0c741f7 into master Aug 30, 2022
@whummer whummer deleted the cfn-parity-stack-updates branch August 30, 2022 14:05
pinzon added a commit that referenced this pull request Aug 30, 2022
* result handler for Kms Key

* fix result handler invocation

* add parity tests and refactor logic for CFn stack resource updates (#6780)

Co-authored-by: Waldemar Hummer <waldemar.hummer@gmail.com>
macnev2013 pushed a commit to macnev2013/localstack that referenced this pull request Sep 4, 2022
macnev2013 pushed a commit to macnev2013/localstack that referenced this pull request Sep 4, 2022
* result handler for Kms Key

* fix result handler invocation

* add parity tests and refactor logic for CFn stack resource updates (localstack#6780)

Co-authored-by: Waldemar Hummer <waldemar.hummer@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants