Closed fitzchak closed 2 years ago
Thanks for filing this bug.
The VpcEndpointServiceDomainName keeps global list of domains to prevent accidental association of two domains with a single service. The uniqueness of the service is determined by the service's uniqueId, which is determined by the types and IDs of all of the nodes in the tree leading up to, and including, the service.
In the case of your tests, a simple workaround is simply to give the Stacks a different ID:
const stack = new ClientStack(app, `test-${Constants.defaultRegion}-Client-PROD`, {
stageName: "PROD",
});
This will cause the IDs of the VpcEndpointService
to be different, which will allow the test to pass.
Give that a shot, and let us know if that solves the issue for you.
This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.
Thanks @njlynch, this indeed solved the issue. I suggest to add this info to the error message as this will mostly fail from tests.
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
What is the problem?
I cannot run tests with VpcEndpointServiceDomainName as in case I have two tests it will throw the following:
Reproduction Steps
In order to reproduce please create the following 2 files and run one of the tests:
client-stack.ts:
client-stack.test.ts
What did you expect to happen?
I expect the test to pass
What actually happened?
The test is failing with
Cannot create a VpcEndpointServiceDomainName for service testuseast1ClientEndpointServiceDBD8CB6F, another VpcEndpointServiceDomainName (subdoamin.test.com) is already associated with it
error.Looks like the validation is not correct as it picking the duplication from the other test.
CDK CLI Version
2.0.8
Framework Version
No response
Node.js Version
14.16.1
OS
Mac
Language
Typescript
Language Version
No response
Other information
No response