-
Notifications
You must be signed in to change notification settings - Fork 4k
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): Set environment for Deploy Assert Stack #22332
Comments
@dontirun can you provide an example of the integ test where you see the behavior? |
import * as cdk from 'monocdk';
import * as ec2 from 'monocdk/aws-ec2';
import * as elbv2 from 'monocdk/aws-elasticloadbalancingv2';
import * as s3 from 'monocdk/aws-s3';
import * as integ from 'monocdk/integ-tests';
const app = new cdk.App();
const stack = new cdk.Stack(app, 'stack',
{
env: { region: 'us-west-2' }
})
const nlb = new elbv2.NetworkLoadBalancer(stack, 'nlb', { vpc: new ec2.Vpc(stack, 'vpc') })
// requires region to be set
nlb.logAccessLogs(new s3.Bucket(stack, 'logbucket'))
const test = new integ.IntegTest(app, 'integ', {
testCases: [stack],
regions: ['us-west-2'],
});
test.assertions.awsApiCall('Elbv2', 'describeLoadBalancers', {
Names: [nlb.loadBalancerName]
});
app.synth();
|
I'm giving a CDKv1 example here because this issue is preventing me from using v2 (without a hacky patch) |
@dontirun thanks for the example, the makes perfect sense and we should definitely add this. |
Closes #22332 ---- ### All Submissions: * [X] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
Describe the feature
Allow setting the AWS environment (account/region) for the deploy assert stack
Use Case
I have a construct that uses ELBv2 access logging. ELBv2 access logging requires setting the region for the cdk environment. As showcased by this error
Error: Region is required to enable ELBv2 access logging
After setting the environment, I received the following error when I attempted to pass a reference to an Api Call in the Integ Test
Error: Stack "foo/DefaultTest/DeployAssert" cannot consume a cross reference from stack "bar". Cross stack references are only supported for stacks deployed to the same environment or between nested stacks and their parent stack
Proposed Solution
Allow setting the cdk environment in IntegTestProps
Other Information
No response
Acknowledgements
CDK version used
2.41.0
Environment details (OS name and version, etc.)
Osx
The text was updated successfully, but these errors were encountered: