Skip to content
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): r5ad instance-type has incorrect value #14179

Merged
merged 4 commits into from
Apr 21, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-ec2/lib/instance-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ export enum InstanceClass {
/**
* Memory optimized instances based on AMD EPYC with local NVME drive, 5th generation
*/
MEMORY5_AMD_NVME_DRIVE = 'r5a',
MEMORY5_AMD_NVME_DRIVE = 'r5ad',

/**
* Memory optimized instances based on AMD EPYC with local NVME drive, 5th generation
*/
R5AD = 'r5a',
R5AD = 'r5ad',

/**
* Memory optimized instances that are also EBS-optimized, 5th generation
Expand Down
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