-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: natEip should be undefined (#10)
- Loading branch information
Aatman
authored
May 4, 2023
1 parent
a2ca736
commit 47f84a9
Showing
2 changed files
with
126 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,126 @@ | ||
describe('my suite', () => { | ||
test.only('my only true test', () => { | ||
expect(1 + 1).toEqual(2); | ||
import * as cdk from 'aws-cdk-lib'; | ||
import * as ec2 from 'aws-cdk-lib/aws-ec2'; | ||
import * as mod from '../src/index'; | ||
|
||
describe('Test', () => { | ||
test('undefined natEip', () => { | ||
|
||
const app = new cdk.App(); | ||
const test = new cdk.Stack(app, 'TestStack'); | ||
|
||
new mod.Network(test, 'NETWORK', { | ||
vpc: { | ||
cidr: '10.145.0.0/16', | ||
subnetConfiguration: [], | ||
}, | ||
subnets: [ | ||
{ | ||
subnetGroupName: 'NATGateway', | ||
subnetType: ec2.SubnetType.PUBLIC, | ||
cidrBlock: ['10.145.0.0/28', '10.145.0.16/28', '10.145.0.32/28'], | ||
availabilityZones: ['ap-south-1a', 'ap-south-1b', 'ap-south-1c'], | ||
ingressNetworkACL: [ | ||
{ | ||
cidr: ec2.AclCidr.ipv4('0.0.0.0/0'), | ||
traffic: ec2.AclTraffic.allTraffic(), | ||
}, | ||
], | ||
routes: [ | ||
], | ||
egressNetworkACL: [ | ||
{ | ||
cidr: ec2.AclCidr.ipv4('0.0.0.0/0'), | ||
traffic: ec2.AclTraffic.allTraffic(), | ||
}, | ||
], | ||
}, | ||
{ | ||
subnetGroupName: 'Private', | ||
subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, | ||
cidrBlock: ['10.145.1.0/24', '10.145.2.0/24', '10.145.3.0/24'], | ||
availabilityZones: ['ap-south-1a', 'ap-south-1b', 'ap-south-1c'], | ||
ingressNetworkACL: [ | ||
{ | ||
cidr: ec2.AclCidr.ipv4('0.0.0.0/0'), | ||
traffic: ec2.AclTraffic.allTraffic(), | ||
}, | ||
], | ||
routes: [ | ||
], | ||
egressNetworkACL: [ | ||
{ | ||
cidr: ec2.AclCidr.ipv4('0.0.0.0/0'), | ||
traffic: ec2.AclTraffic.allTraffic(), | ||
}, | ||
], | ||
tags: { | ||
'kubernetes.io/role/internal-elb': '1', | ||
'kubernetes.io/cluster/SC-PROD-APP': 'owned', | ||
}, | ||
}, | ||
], | ||
}); | ||
}); | ||
}); | ||
|
||
|
||
test('defined but emtpy natEip', () => { | ||
const app = new cdk.App(); | ||
const test = new cdk.Stack(app, 'TestStack2'); | ||
|
||
new mod.Network(test, 'NETWORK', { | ||
vpc: { | ||
cidr: '10.145.0.0/16', | ||
subnetConfiguration: [], | ||
}, | ||
subnets: [ | ||
{ | ||
subnetGroupName: 'NATGateway', | ||
subnetType: ec2.SubnetType.PUBLIC, | ||
cidrBlock: ['10.145.0.0/28', '10.145.0.16/28', '10.145.0.32/28'], | ||
availabilityZones: ['ap-south-1a', 'ap-south-1b', 'ap-south-1c'], | ||
ingressNetworkACL: [ | ||
{ | ||
cidr: ec2.AclCidr.ipv4('0.0.0.0/0'), | ||
traffic: ec2.AclTraffic.allTraffic(), | ||
}, | ||
], | ||
routes: [ | ||
], | ||
egressNetworkACL: [ | ||
{ | ||
cidr: ec2.AclCidr.ipv4('0.0.0.0/0'), | ||
traffic: ec2.AclTraffic.allTraffic(), | ||
}, | ||
], | ||
}, | ||
{ | ||
subnetGroupName: 'Private', | ||
subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, | ||
cidrBlock: ['10.145.1.0/24', '10.145.2.0/24', '10.145.3.0/24'], | ||
availabilityZones: ['ap-south-1a', 'ap-south-1b', 'ap-south-1c'], | ||
ingressNetworkACL: [ | ||
{ | ||
cidr: ec2.AclCidr.ipv4('0.0.0.0/0'), | ||
traffic: ec2.AclTraffic.allTraffic(), | ||
}, | ||
], | ||
routes: [ | ||
], | ||
egressNetworkACL: [ | ||
{ | ||
cidr: ec2.AclCidr.ipv4('0.0.0.0/0'), | ||
traffic: ec2.AclTraffic.allTraffic(), | ||
}, | ||
], | ||
tags: { | ||
'kubernetes.io/role/internal-elb': '1', | ||
'kubernetes.io/cluster/SC-PROD-APP': 'owned', | ||
}, | ||
}, | ||
], | ||
}); | ||
|
||
expect(test).toThrowError; | ||
}); | ||
}); | ||
|