Skip to content

Commit

Permalink
fix(ec2): r5ad instance-type has incorrect value
Browse files Browse the repository at this point in the history
add unit tests covering a sample of nvme instance classes
  • Loading branch information
Matthew Kuntz committed Apr 14, 2021
1 parent 73710e2 commit 94d9ea9
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions packages/@aws-cdk/aws-ec2/test/instance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,39 @@ nodeunitShim({

test.done();
},
'instances with local NVME drive are correctly named'(test: Test) {
// GIVEN
const sampleInstanceClassKeys = [{
key: 'R5D',
value: 'r5d',
}, {
key: 'MEMORY5_NVME_DRIVE',
value: 'r5d',
}, {
key: 'R5AD',
value: 'r5ad',
}, {
key: 'MEMORY5_AMD_NVME_DRIVE',
value: 'r5ad',
}, {
key: 'M5AD',
value: 'm5ad',
}, {
key: 'STANDARD5_AMD_NVME_DRIVE',
value: 'm5ad',
}]; // A sample of instances with NVME drives

for (const instanceClass of sampleInstanceClassKeys) {
// WHEN
const key = instanceClass.key as keyof(typeof InstanceClass);
const instanceType = InstanceClass[key];

// THEN
expect(instanceType).toBe(instanceClass.value);
}

test.done();
},
'instance architecture throws an error when instance type is invalid'(test: Test) {
// GIVEN
const malformedInstanceTypes = ['t4', 't4g.nano.', 't4gnano', ''];
Expand Down

0 comments on commit 94d9ea9

Please sign in to comment.