-
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
fix(ec2): can't add non-default routes to subnets #5332
Conversation
Thanks so much for taking the time to contribute to the AWS CDK ❤️ We will shortly assign someone to review this pull request and help get it
|
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Hi Ian, Could you add a test? This might help you: https://docs.aws.amazon.com/cdk/latest/guide/testing.html You can also have a peek at the other tests in the same package to get inspiration. |
Hi @rix0rrr - I was thinking of adding the unit test for this into the VPC unit tests, does that make sense to you as the right place? |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
@rix0rrr - I've added a test to validate the removal of the |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Hi @ialford,
You can check whether a test is a good test by running it WITHOUT your proposed code change (in which case it should fail) and again WITH your proposed code change (in which case it should succeed). By doing that, you know the test is actually testing the code change and not just passing by accident. I would propose changing it to the following: 'Can add an IPv6 route'(test: Test) {
// GIVEN
const stack = getTestStack();
// WHEN
const vpc = new Vpc(stack, 'VPC');
(vpc.publicSubnets[0] as PublicSubnet).addRoute('SomeRoute', {
destinationIpv6CidrBlock: '2001:4860:4860::8888/32',
routerId: 'router-1',
routerType: RouterType.NETWORK_INTERFACE
});
// THEN
expect(stack).to(haveResourceLike("AWS::EC2::Route", {
DestinationIpv6CidrBlock: '2001:4860:4860::8888/32',
NetworkInterfaceId: 'router-1'
}));
test.done();
}, |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Hi @rix0rrr - I added the test that you suggested as well as created a test for explicitly adding an IPv4 Route. I also moved them to run under the VPC suite of tests, since that is where the rest of the subnet-related tests run. I removed the test I originally submitted as well - I believe that the error handling here handles the logic that I was testing originally. |
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 good, thanks for submitting!
Thank you for contributing! Your pull request is now being automatically merged. |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
* fixes using destinationCidrBlock to subnet route * fix(ec2): adds unit test for default routes * chore(ec2): replace accidentally deleted test * chore(ec2): run linter * fix(ec2): update unit test to check route creation
Update the
destinationCidrBlockIPV6
to use the proper options and not duplicatedestinationCidrBlock
fixes #5321
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license