Skip to content

Commit

Permalink
Added testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Michae1CC committed Apr 25, 2024
1 parent 89cc140 commit 291c665
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 19 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -403,10 +403,6 @@
"Key": "load_balancing.cross_zone.enabled",
"Value": "true"
},
{
"Key": "ipv6.deny_all_igw_traffic",
"Value": "true"
},
{
"Key": "dns_record.client_routing_policy",
"Value": "partial_availability_zone_affinity"
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -99,10 +99,6 @@ describe('tests', () => {
Key: 'deletion_protection.enabled',
Value: 'true',
},
{
Key: 'ipv6.deny_all_igw_traffic',
Value: 'true',
},
{
Key: 'routing.http2.enabled',
Value: 'false',
Expand Down Expand Up @@ -171,6 +167,21 @@ describe('tests', () => {
}).toThrow('\'clientKeepAlive\' must be between 60 and 604800 seconds. Got: 100 milliseconds');
});

test('throw error for denyAllIgwTraffic set to false for Ipv4 adressing.', () => {
// GIVEN
const stack = new cdk.Stack();
const vpc = new ec2.Vpc(stack, 'Stack');

// THEN
expect(() => {
new elbv2.ApplicationLoadBalancer(stack, 'LB', {
vpc,
denyAllIgwTraffic: false,
ipAddressType: elbv2.IpAddressType.IPV4,
});
}).toThrow('\'denyAllIgwTraffic\' cannot be false on load balancers with IPv4 addressing.');
});

describe('Desync mitigation mode', () => {
test('Defensive', () => {
// GIVEN
Expand Down
Expand Up @@ -91,10 +91,6 @@ describe('tests', () => {
Key: 'load_balancing.cross_zone.enabled',
Value: 'true',
},
{
Key: 'ipv6.deny_all_igw_traffic',
Value: 'true',
},
{
Key: 'dns_record.client_routing_policy',
Value: 'partial_availability_zone_affinity',
Expand Down Expand Up @@ -488,6 +484,21 @@ describe('tests', () => {
}).toThrow('Load balancer name: "my load balancer" must contain only alphanumeric characters or hyphens.');
});

test('loadBalancerName unallowed: denyAllIgwTraffic set to false for Ipv4 adressing', () => {
// GIVEN
const stack = new cdk.Stack();
const vpc = new ec2.Vpc(stack, 'Stack');

// THEN
expect(() => {
new elbv2.NetworkLoadBalancer(stack, 'NLB', {
vpc,
denyAllIgwTraffic: false,
ipAddressType: elbv2.IpAddressType.IPV4,
});
}).toThrow('\'denyAllIgwTraffic\' cannot be false on load balancers with IPv4 addressing.');
});

test('imported network load balancer with no vpc specified throws error when calling addTargets', () => {
// GIVEN
const stack = new cdk.Stack();
Expand Down

0 comments on commit 291c665

Please sign in to comment.