@@ -6,7 +6,7 @@ import * as iam from '../../aws-iam';
66import * as cdk from '../../core' ;
77import * as cxapi from '../../cx-api' ;
88import * as eks from '../lib' ;
9- import { NodegroupAmiType , TaintEffect } from '../lib' ;
9+ import { isGpuInstanceType , NodegroupAmiType , TaintEffect } from '../lib' ;
1010
1111/* eslint-disable max-len */
1212
@@ -617,8 +617,8 @@ describe('node group', () => {
617617 new eks . Nodegroup ( stack , 'Nodegroup' , {
618618 cluster,
619619 instanceTypes : [
620- new ec2 . InstanceType ( 'p3 .large' ) ,
621- new ec2 . InstanceType ( 'g3 .large' ) ,
620+ new ec2 . InstanceType ( 'g6e .large' ) ,
621+ new ec2 . InstanceType ( 'g5 .large' ) ,
622622 ] ,
623623 } ) ;
624624
@@ -1735,3 +1735,38 @@ describe('node group', () => {
17351735 expect ( ( ) => cluster . addNodegroupCapacity ( 'ng' , { maxUnavailablePercentage : 101 } ) ) . toThrow ( / m a x U n a v a i l a b l e P e r c e n t a g e m u s t b e b e t w e e n 1 a n d 1 0 0 / ) ;
17361736 } ) ;
17371737} ) ;
1738+
1739+ describe ( 'isGpuInstanceType' , ( ) => {
1740+ it ( 'should return true for known GPU instance types' , ( ) => {
1741+ const gpuInstanceTypes = [
1742+ ec2 . InstanceType . of ( ec2 . InstanceClass . P2 , ec2 . InstanceSize . XLARGE ) ,
1743+ ec2 . InstanceType . of ( ec2 . InstanceClass . G3 , ec2 . InstanceSize . XLARGE ) ,
1744+ ec2 . InstanceType . of ( ec2 . InstanceClass . P4D , ec2 . InstanceSize . LARGE ) ,
1745+ ec2 . InstanceType . of ( ec2 . InstanceClass . G6 , ec2 . InstanceSize . MEDIUM ) ,
1746+ ec2 . InstanceType . of ( ec2 . InstanceClass . G6E , ec2 . InstanceSize . XLARGE2 ) ,
1747+ ] ;
1748+ gpuInstanceTypes . forEach ( instanceType => {
1749+ expect ( isGpuInstanceType ( instanceType ) ) . toBe ( true ) ;
1750+ } ) ;
1751+ } ) ;
1752+ it ( 'should return false for non-GPU instance types' , ( ) => {
1753+ const nonGpuInstanceTypes = [
1754+ ec2 . InstanceType . of ( ec2 . InstanceClass . T3 , ec2 . InstanceSize . MICRO ) ,
1755+ ec2 . InstanceType . of ( ec2 . InstanceClass . M5 , ec2 . InstanceSize . LARGE ) ,
1756+ ec2 . InstanceType . of ( ec2 . InstanceClass . C5 , ec2 . InstanceSize . XLARGE ) ,
1757+ ] ;
1758+ nonGpuInstanceTypes . forEach ( instanceType => {
1759+ expect ( isGpuInstanceType ( instanceType ) ) . toBe ( false ) ;
1760+ } ) ;
1761+ } ) ;
1762+ it ( 'should return true for different sizes of GPU instance types' , ( ) => {
1763+ const gpuInstanceTypes = [
1764+ ec2 . InstanceType . of ( ec2 . InstanceClass . G6 , ec2 . InstanceSize . XLARGE ) ,
1765+ ec2 . InstanceType . of ( ec2 . InstanceClass . G6 , ec2 . InstanceSize . XLARGE16 ) ,
1766+ ec2 . InstanceType . of ( ec2 . InstanceClass . G6 , ec2 . InstanceSize . XLARGE48 ) ,
1767+ ] ;
1768+ gpuInstanceTypes . forEach ( instanceType => {
1769+ expect ( isGpuInstanceType ( instanceType ) ) . toBe ( true ) ;
1770+ } ) ;
1771+ } ) ;
1772+ } ) ;
0 commit comments