Skip to content

Conversation

@simonrw
Copy link
Contributor

@simonrw simonrw commented Aug 7, 2025

Motivation

At time of writing, the CFNV2:Validation errors were the biggest class of errors in the new provider's test suite. This PR attempts to tackle (or at least reassign them) to make the biggest push towards parity.

Since we have made the validator a subclass of the preprocessor, we can now raise ValidationErrors in the preprocessor which will be turned into proper service exceptions. This is the natural place to put this functionality, but it now can be driven during CreateChangeSet|CreateStack|UpdateStack i.e. synchronously

Changes

  • Hide most logged exceptions from the logs unless CFN_VERBOSE_ERRORS=1
  • Move the validation of the logical resource ids to the preprocessor
  • Improve parity of error messages with looking up missing keys from mappings
  • The validator now inherits from the preprocessor to support resolving mapping values
  • Fail to create stack if a stack already exists with that name and is active
  • Unskiped 4 tests
  • Reassigned 5 tests (to CFNV2:Transform, sorry @pinzon!)
  • Added 2 (passing) tests

TODO

@simonrw simonrw added this to the 4.8 milestone Aug 7, 2025
@simonrw simonrw added semver: minor Non-breaking changes which can be included in minor releases, but not in patch releases review: merge when ready Signals to the reviewer that a PR can be merged if accepted labels Aug 7, 2025
@github-actions
Copy link

github-actions bot commented Aug 7, 2025

Test Results - Preflight, Unit

22 063 tests  ±0   20 329 ✅ ±0   6m 25s ⏱️ +12s
     1 suites ±0    1 734 💤 ±0 
     1 files   ±0        0 ❌ ±0 

Results for commit d878dfd. ± Comparison against base commit 4464cd2.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Aug 7, 2025

Test Results (amd64) - Acceptance

7 tests  ±0   5 ✅ ±0   3m 18s ⏱️ +6s
1 suites ±0   2 💤 ±0 
1 files   ±0   0 ❌ ±0 

Results for commit d878dfd. ± Comparison against base commit 4464cd2.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Aug 7, 2025

LocalStack Community integration with Pro

  2 files  ±    0    2 suites  ±0   22m 22s ⏱️ - 1h 23m 22s
553 tests  - 4 070  329 ✅  - 3 857  224 💤  - 213  0 ❌ ±0 
555 runs   - 4 070  329 ✅  - 3 857  226 💤  - 213  0 ❌ ±0 

Results for commit d878dfd. ± Comparison against base commit 4464cd2.

This pull request removes 4072 and adds 2 tests. Note that renamed tests count towards both.
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_lambda_dynamodb
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_opensearch_crud
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_search_books
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_setup
tests.aws.scenario.kinesis_firehose.test_kinesis_firehose.TestKinesisFirehoseScenario ‑ test_kinesis_firehose_s3
tests.aws.scenario.lambda_destination.test_lambda_destination_scenario.TestLambdaDestinationScenario ‑ test_destination_sns
tests.aws.scenario.lambda_destination.test_lambda_destination_scenario.TestLambdaDestinationScenario ‑ test_infra
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_prefill_dynamodb_table
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_stepfunctions_input_recipient_list[step_function_input0-SUCCEEDED]
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_stepfunctions_input_recipient_list[step_function_input1-SUCCEEDED]
…
tests.aws.services.cloudformation.engine.test_mappings.TestCloudFormationMappings ‑ test_async_mapping_error_first_level_v2
tests.aws.services.cloudformation.engine.test_mappings.TestCloudFormationMappings ‑ test_async_mapping_error_second_level_v2
This pull request removes 215 skipped tests and adds 2 skipped tests. Note that renamed tests count towards both.
tests.aws.scenario.kinesis_firehose.test_kinesis_firehose.TestKinesisFirehoseScenario ‑ test_kinesis_firehose_s3
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_stepfunctions_input_recipient_list[step_function_input4-FAILED]
tests.aws.scenario.mythical_mysfits.test_mythical_misfits.TestMythicalMisfitsScenario ‑ test_deployed_infra_state
tests.aws.scenario.mythical_mysfits.test_mythical_misfits.TestMythicalMisfitsScenario ‑ test_populate_data
tests.aws.scenario.mythical_mysfits.test_mythical_misfits.TestMythicalMisfitsScenario ‑ test_user_clicks_are_stored
tests.aws.services.apigateway.test_apigateway_api.TestApiGatewayApiRestApi ‑ test_get_api_case_insensitive
tests.aws.services.apigateway.test_apigateway_api.TestApiGatewayApiRestApi ‑ test_update_rest_api_concatenation_of_errors
tests.aws.services.apigateway.test_apigateway_api.TestApigatewayIntegration ‑ test_integration_response_invalid_responsetemplates
tests.aws.services.apigateway.test_apigateway_api.TestApigatewayIntegration ‑ test_put_integration_request_parameter_bool_type
tests.aws.services.apigateway.test_apigateway_basic.TestAPIGateway ‑ test_api_gateway_authorizer_crud
…
tests.aws.services.cloudformation.engine.test_mappings.TestCloudFormationMappings ‑ test_async_mapping_error_first_level_v2
tests.aws.services.cloudformation.engine.test_mappings.TestCloudFormationMappings ‑ test_async_mapping_error_second_level_v2

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Aug 7, 2025

Test Results (amd64) - Integration, Bootstrap

  5 files    5 suites   33m 23s ⏱️
577 tests 354 ✅ 223 💤 0 ❌
583 runs  354 ✅ 229 💤 0 ❌

Results for commit d878dfd.

♻️ This comment has been updated with latest results.

@simonrw simonrw marked this pull request as ready for review August 8, 2025 04:38
Copy link
Member

@pinzon pinzon left a comment

Choose a reason for hiding this comment

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

LGTM. 👍
Just some minor comments.

Copy link
Member

Choose a reason for hiding this comment

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

It's progress 👍

snapshot.match("mapping_nonexisting_key_exc", e.value.response)

@skip_if_v2_provider(reason="CFNV2:Validation")
@skip_if_v2_provider(reason="CFNV2:Validation replaced with v2 test below")
Copy link
Member

Choose a reason for hiding this comment

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

we could consider removing this test.

"Resource provider operation failed: '%s'",
reason,
exc_info=LOG.isEnabledFor(logging.DEBUG),
exc_info=LOG.isEnabledFor(logging.DEBUG) and config.CFN_VERBOSE_ERRORS,
Copy link
Member

Choose a reason for hiding this comment

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

is this Flag new? I don't see it in the docs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not in the docs, we planned it to be mostly for getting more info from support cases. I was getting confused by tracebacks in logs which ones mattered and which didn't.

Copy link
Member

Choose a reason for hiding this comment

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

🎉

@simonrw simonrw merged commit 809d971 into main Aug 8, 2025
40 checks passed
@simonrw simonrw deleted the cfn/v2/validation-2 branch August 8, 2025 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review: merge when ready Signals to the reviewer that a PR can be merged if accepted semver: minor Non-breaking changes which can be included in minor releases, but not in patch releases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants