@@ -199,6 +199,15 @@ describe('instance', () => {
199
199
volumeType : EbsDeviceVolumeType . IO1 ,
200
200
iops : 5000 ,
201
201
} ) ,
202
+ } , {
203
+ deviceName : 'ebs-gp3' ,
204
+ mappingEnabled : true ,
205
+ volume : BlockDeviceVolume . ebs ( 15 , {
206
+ deleteOnTermination : true ,
207
+ encrypted : true ,
208
+ volumeType : EbsDeviceVolumeType . GP3 ,
209
+ iops : 5000 ,
210
+ } ) ,
202
211
} , {
203
212
deviceName : 'ebs-cmk' ,
204
213
mappingEnabled : true ,
@@ -236,6 +245,16 @@ describe('instance', () => {
236
245
VolumeType : 'io1' ,
237
246
} ,
238
247
} ,
248
+ {
249
+ DeviceName : 'ebs-gp3' ,
250
+ Ebs : {
251
+ DeleteOnTermination : true ,
252
+ Encrypted : true ,
253
+ Iops : 5000 ,
254
+ VolumeSize : 15 ,
255
+ VolumeType : 'gp3' ,
256
+ } ,
257
+ } ,
239
258
{
240
259
DeviceName : 'ebs-cmk' ,
241
260
Ebs : {
@@ -306,8 +325,25 @@ describe('instance', () => {
306
325
} ] ,
307
326
} ) ;
308
327
} ) . toThrow ( / o p s p r o p e r t y i s r e q u i r e d w i t h v o l u m e T y p e : E b s D e v i c e V o l u m e T y p e .I O 1 / ) ;
328
+ } ) ;
309
329
310
-
330
+ test ( 'throws if volumeType === IO2 without iops' , ( ) => {
331
+ // THEN
332
+ expect ( ( ) => {
333
+ new Instance ( stack , 'Instance' , {
334
+ vpc,
335
+ machineImage : new AmazonLinuxImage ( ) ,
336
+ instanceType : InstanceType . of ( InstanceClass . T3 , InstanceSize . LARGE ) ,
337
+ blockDevices : [ {
338
+ deviceName : 'ebs' ,
339
+ volume : BlockDeviceVolume . ebs ( 15 , {
340
+ deleteOnTermination : true ,
341
+ encrypted : true ,
342
+ volumeType : EbsDeviceVolumeType . IO2 ,
343
+ } ) ,
344
+ } ] ,
345
+ } ) ;
346
+ } ) . toThrow ( / o p s p r o p e r t y i s r e q u i r e d w i t h v o l u m e T y p e : E b s D e v i c e V o l u m e T y p e .I O 1 a n d E b s D e v i c e V o l u m e T y p e .I O 2 / ) ;
311
347
} ) ;
312
348
313
349
test ( 'warning if iops without volumeType' , ( ) => {
@@ -327,12 +363,10 @@ describe('instance', () => {
327
363
328
364
// THEN
329
365
expect ( instance . node . metadataEntry [ 0 ] . type ) . toEqual ( cxschema . ArtifactMetadataEntryType . WARN ) ;
330
- expect ( instance . node . metadataEntry [ 0 ] . data ) . toEqual ( 'iops will be ignored without volumeType: EbsDeviceVolumeType.IO1' ) ;
331
-
332
-
366
+ expect ( instance . node . metadataEntry [ 0 ] . data ) . toEqual ( 'iops will be ignored without volumeType: IO1, IO2, or GP3' ) ;
333
367
} ) ;
334
368
335
- test ( 'warning if iops and volumeType !== IO1 ' , ( ) => {
369
+ test ( 'warning if iops and invalid volumeType ' , ( ) => {
336
370
const instance = new Instance ( stack , 'Instance' , {
337
371
vpc,
338
372
machineImage : new AmazonLinuxImage ( ) ,
@@ -350,9 +384,7 @@ describe('instance', () => {
350
384
351
385
// THEN
352
386
expect ( instance . node . metadataEntry [ 0 ] . type ) . toEqual ( cxschema . ArtifactMetadataEntryType . WARN ) ;
353
- expect ( instance . node . metadataEntry [ 0 ] . data ) . toEqual ( 'iops will be ignored without volumeType: EbsDeviceVolumeType.IO1' ) ;
354
-
355
-
387
+ expect ( instance . node . metadataEntry [ 0 ] . data ) . toEqual ( 'iops will be ignored without volumeType: IO1, IO2, or GP3' ) ;
356
388
} ) ;
357
389
} ) ;
358
390
0 commit comments