-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into qmg-rbass/comparison-operators
- Loading branch information
Showing
26 changed files
with
392 additions
and
190 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,5 @@ nyc.config.js | |
.LAST_PACKAGE | ||
*.snk | ||
!.eslintrc.js | ||
|
||
!jest.config.js |
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 |
---|---|---|
|
@@ -21,4 +21,5 @@ tsconfig.json | |
.eslintrc.js | ||
|
||
# exclude cdk artifacts | ||
**/cdk.out | ||
**/cdk.out | ||
jest.config.js |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
const baseConfig = require('../../../tools/cdk-build-tools/config/jest.config'); | ||
module.exports = baseConfig; |
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
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
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import * as cdk from '@aws-cdk/core'; | ||
import * as ec2 from '../lib'; | ||
|
||
test('NetworkAclEntry CidrBlock should be optional', () => { | ||
const stack = new cdk.Stack(); | ||
|
||
new ec2.CfnNetworkAclEntry(stack, 'ACL', { | ||
// Note the conspicuous absence of cidrBlock | ||
networkAclId: 'asdf', | ||
protocol: 5, | ||
ruleAction: 'action', | ||
ruleNumber: 1, | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import { App, Stack } from '@aws-cdk/core'; | ||
import * as ec2 from '../lib'; | ||
|
||
let app: App; | ||
let stack: Stack; | ||
|
||
beforeEach(() => { | ||
app = new App(); | ||
stack = new Stack(app, 'Stack', { | ||
env: { account: '1234', region: 'testregion' }, | ||
}); | ||
}); | ||
|
||
test('can make and use a Windows image', () => { | ||
// WHEN | ||
const image = new ec2.GenericWindowsImage({ | ||
testregion: 'ami-1234', | ||
}); | ||
|
||
// THEN | ||
const details = image.getImage(stack); | ||
expect(details.imageId).toEqual('ami-1234'); | ||
expect(details.osType).toEqual(ec2.OperatingSystemType.WINDOWS); | ||
}); | ||
|
||
test('WindowsImage retains userdata if given', () => { | ||
// WHEN | ||
const ud = ec2.UserData.forWindows(); | ||
|
||
const image = new ec2.GenericWindowsImage({ | ||
testregion: 'ami-1234', | ||
}, { | ||
userData: ud, | ||
}); | ||
|
||
// THEN | ||
const details = image.getImage(stack); | ||
expect(details.userData).toEqual(ud); | ||
}); | ||
|
||
test('WindowsImage creates UserData if not given', () => { | ||
// WHEN | ||
const image = new ec2.GenericWindowsImage({ | ||
testregion: 'ami-1234', | ||
}); | ||
|
||
// THEN | ||
const details = image.getImage(stack); | ||
expect(isWindowsUserData(details.userData)).toBeTruthy(); | ||
}); | ||
|
||
test('LookupMachineImage default search', () => { | ||
// GIVEN | ||
|
||
// WHEN | ||
new ec2.LookupMachineImage({ name: 'bla*', owners: ['amazon'] }).getImage(stack); | ||
|
||
// THEN | ||
const missing = app.synth().manifest.missing || []; | ||
expect(missing).toEqual([ | ||
{ | ||
key: 'ami:account=1234:filters.image-type.0=machine:filters.name.0=bla*:filters.state.0=available:owners.0=amazon:region=testregion', | ||
props: { | ||
account: '1234', | ||
region: 'testregion', | ||
owners: [ 'amazon' ], | ||
filters: { | ||
'name': [ 'bla*' ], | ||
'state': [ 'available' ], | ||
'image-type': [ 'machine' ], | ||
}, | ||
}, | ||
provider: 'ami', | ||
}, | ||
]); | ||
}); | ||
|
||
test('LookupMachineImage creates correct type of UserData', () => { | ||
// WHEN | ||
const linuxDetails = new ec2.LookupMachineImage({ name: 'bla*', owners: ['amazon'] }).getImage(stack); | ||
const windowsDetails = new ec2.LookupMachineImage({ name: 'bla*', owners: ['amazon'], windows: true }).getImage(stack); | ||
|
||
// THEN | ||
expect(isWindowsUserData(windowsDetails.userData)).toBeTruthy(); | ||
expect(isLinuxUserData(linuxDetails.userData)).toBeTruthy(); | ||
}); | ||
|
||
function isWindowsUserData(ud: ec2.UserData) { | ||
return ud.render().indexOf('powershell') > -1; | ||
} | ||
|
||
function isLinuxUserData(ud: ec2.UserData) { | ||
return ud.render().indexOf('bash') > -1; | ||
} |
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.