-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
CFNv2: implement describe-stack-resource #12912
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
Conversation
LocalStack Community integration with Pro 2 files ± 0 2 suites ±0 1h 43m 18s ⏱️ - 5m 8s Results for commit 5cb7f8d. ± Comparison against base commit fb42a08. This pull request removes 460 tests.
♻️ This comment has been updated with latest results. |
Test Results (amd64) - Integration, Bootstrap 5 files 5 suites 2h 19m 51s ⏱️ Results for commit 5cb7f8d. ♻️ This comment has been updated with latest results. |
Test Results (MA/MR) - Preflight, Unit21 983 tests 20 249 ✅ 6m 24s ⏱️ Results for commit cea3566. |
Test Results (amd64, MA/MR) - Acceptance7 tests 5 ✅ 3m 8s ⏱️ Results for commit cea3566. |
Test Results (amd64, MA/MR) - Integration, Bootstrap 5 files 5 suites 2h 21m 53s ⏱️ Results for commit cea3566. |
We don't need preprocessing in this implmenentation
This reverts commit cea3566.
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.
Nice to see the tests being unskipped! The implementation, the snapshots, and the tiny pipeline change are looking good! 💯
@@ -339,7 +339,7 @@ jobs: | |||
AWS_DEFAULT_REGION: "us-east-1" | |||
JUNIT_REPORTS_FILE: "pytest-junit-community-${{ matrix.group }}.xml" | |||
TEST_PATH: "../../localstack/tests/aws/" # TODO: run tests in tests/integration | |||
PYTEST_ARGS: "${{ env.TINYBIRD_PYTEST_ARGS }}${{ env.TESTSELECTION_PYTEST_ARGS }}--splits ${{ strategy.job-total }} --group ${{ matrix.group }} --durations-path ../../localstack/.test_durations --store-durations" | |||
PYTEST_ARGS: "${{ env.TINYBIRD_PYTEST_ARGS }}${{ env.TESTSELECTION_PYTEST_ARGS }}--splits ${{ strategy.job-total }} --group ${{ matrix.group }} --durations-path ../../localstack/.test_durations --store-durations --ignore ../../localstack/tests/aws/services/cloudformation/v2" |
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.
FYI: As far as I can tell, this change really just migrates the ignore introduced in #12871 to the tests executed against Pro.
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.
SQS changes are looking good 👍
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 very good 👍 . The only blocker is the location of the new tests.
@@ -1061,3 +1060,13 @@ def test_stack_resource_not_found(deploy_cfn_template, aws_client, snapshot): | |||
|
|||
snapshot.add_transformer(snapshot.transform.regex(stack.stack_name, "<stack-name>")) | |||
snapshot.match("Error", ex.value.response) | |||
|
|||
|
|||
@markers.aws.validated |
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.
comment: can't believe we didn't have this validation tested. 😅
Edit: This test should be moved too.
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.
Changes: The tests look great but I'd prefer if we move them to the original CFn test folder and conditionally skip them if the old engine doesn't support them.
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.
At some point in the near future I want to re-merge the tests again so they we don't have divergence. And yes these are tests that don't work with the old engine so would require explicit skipping. Is it ok to move the tests at that point? I might work on this tomorrow if this PR is approved
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.
comment: Nice 🎉
self.resources[logical_resource_id].update(extra_resource_properties) | ||
# XXX for legacy delete_stack compatibility | ||
self.resources[logical_resource_id]["LogicalResourceId"] = logical_resource_id | ||
self.resources[logical_resource_id]["Type"] = resource_type | ||
|
||
status_from_action = EventOperationFromAction[action.value] | ||
physical_resource_id = ( | ||
self._get_physical_id(logical_resource_id) | ||
extra_resource_properties["PhysicalResourceId"] | ||
if resource_provider | ||
else MOCKED_REFERENCE | ||
) | ||
self.resources[logical_resource_id]["PhysicalResourceId"] = physical_resource_id | ||
resolved_resource = ResolvedResource( | ||
Properties=event.resource_model, | ||
LogicalResourceId=logical_resource_id, | ||
Type=resource_type, | ||
LastUpdatedTimestamp=datetime.now(timezone.utc), | ||
ResourceStatus=ResourceStatus(f"{status_from_action}_COMPLETE"), | ||
PhysicalResourceId=physical_resource_id, | ||
) | ||
# TODO: do we actually need this line? | ||
resolved_resource.update(extra_resource_properties) | ||
|
||
self.resources[logical_resource_id] = resolved_resource | ||
|
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.
question/comment: Does this mean that we only store the resource description when the event is successful? Is that correct? If not, we could move the storage one level above,
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.
You make an excellent point. However we don't have much test coverage of this situation. It should be fairly easy to trigger: set up a resource definition with deliberately invalid data. Then the stack will be left in a bad state, HOWEVER we don't yet model that state and behaviour. I think that's a pre-requisite. I would feel nervous to implement something as fundamental as that without test coverage. I would love it if at the end of this initiative we have correct rollback behaviour but I'm not sure we will yet.
Perhaps I can work on this in a follow up?
Motivation
The current V2 CloudFormation provider does not support the describe_stack_resource operation. In order to reach parity with the v1 provider it must do.
Changes
create_change_set
returns (i.e. during the modeling phase). This can be a place to hook other validations as well