-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
integ-tests: invalid AssertionResults
logical ID
#29700
integ-tests: invalid AssertionResults
logical ID
#29700
Comments
Thanks @nmussy for creating this and offereing to create a PR. |
Thank you for opening this issue and creating the PR! |
Yes I agree with you this should be sluggified.
Before we have a PR to address that, it would be easy to work it around without using |
### Issue # (if applicable) Closes #29700 I've also opened #29701 to catch similar issues at synth time in the future ### Reason for this change When running `httpApiCall('url').expect`, the `AssertionResults` output logical ID would be overridden with an invalid name, containing the URL slashes. This issue was not noticed earlier because, as far as I can tell, assertions were only made with `Token`/`Ref` URLs, e.g. `apigw.DomainName` ### Description of changes * Remove non-alphanumeric characters from the overridden `AssertionResults` output logical ID * I've also added a bit of documentation to `ExpectedResult`, I noticed it was slightly lacking while creating the integration test ### Description of how you validated changes I've added unit and integration tests. The integration tests include both tests with API Gateway, to cover unresolved URLs, and to https://httpbin.org/ to test this fix ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one. |
Describe the bug
When adding an assertion to a
httpApiCall
, the CDK generates an invalid logical ID for itsCfnOutput
Expected Behavior
The generated
CfnOutput
should have a valid logical IDCurrent Behavior
The URL used to override the
CfnOutput
logical ID is not sluggified:aws-cdk/packages/@aws-cdk/integ-tests-alpha/lib/assertions/http-call.ts
Lines 48 to 50 in 36fd79d
Reproduction Steps
Raised by Tobias Vollmer on https://cdk.dev/:
$ npx integ-runner --directory ./test-integ-tests --parallel-regions eu-central-1 --force Deployment failed: Error [ValidationError]: Template format error: Outputs name 'AssertionResultsHttpApiCallhttpbin.org/get0f06632dfa7261b35a1569da58f981ba' is non alphanumeric.
I confirmed this by adding this unit test to
deploy-assert.test.ts
:Possible Solution
Slugify the URL before appending it to the logical ID
Additional Information/Context
No response
CDK CLI Version
2.135.0
Framework Version
No response
Node.js Version
v20.11.1
OS
macOS 14.4.1
Language
TypeScript
Language Version
5.4.3
Other information
I'll open a PR to fix this shortly. I'll also check to make sure that
invokeFunction
andawsApiCall
do not run into the same issue, and have tests to check itThe text was updated successfully, but these errors were encountered: