@@ -362,3 +362,121 @@ test('if anything besides an ECS Service references the changed TaskDefinition,
362
362
expect ( deployStackResult ) . toBeUndefined ( ) ;
363
363
expect ( mockRegisterTaskDef ) . not . toHaveBeenCalled ( ) ;
364
364
} ) ;
365
+
366
+ test ( 'should call registerTaskDefinition with certain properties not lowercased' , async ( ) => {
367
+ // GIVEN
368
+ setup . setCurrentCfnStackTemplate ( {
369
+ Resources : {
370
+ TaskDef : {
371
+ Type : 'AWS::ECS::TaskDefinition' ,
372
+ Properties : {
373
+ Family : 'my-task-def' ,
374
+ ContainerDefinitions : [
375
+ { Image : 'image1' } ,
376
+ ] ,
377
+ Volumes : [
378
+ {
379
+ DockerVolumeConfiguration : {
380
+ DriverOpts : { Option1 : 'option1' } ,
381
+ Labels : { Label1 : 'label1' } ,
382
+ } ,
383
+ } ,
384
+ ] ,
385
+ } ,
386
+ } ,
387
+ Service : {
388
+ Type : 'AWS::ECS::Service' ,
389
+ Properties : {
390
+ TaskDefinition : { Ref : 'TaskDef' } ,
391
+ } ,
392
+ } ,
393
+ } ,
394
+ } ) ;
395
+ setup . pushStackResourceSummaries (
396
+ setup . stackSummaryOf ( 'Service' , 'AWS::ECS::Service' ,
397
+ 'arn:aws:ecs:region:account:service/my-cluster/my-service' ) ,
398
+ ) ;
399
+ mockRegisterTaskDef . mockReturnValue ( {
400
+ taskDefinition : {
401
+ taskDefinitionArn : 'arn:aws:ecs:region:account:task-definition/my-task-def:3' ,
402
+ } ,
403
+ } ) ;
404
+ const cdkStackArtifact = setup . cdkStackArtifactOf ( {
405
+ template : {
406
+ Resources : {
407
+ TaskDef : {
408
+ Type : 'AWS::ECS::TaskDefinition' ,
409
+ Properties : {
410
+ Family : 'my-task-def' ,
411
+ ContainerDefinitions : [
412
+ {
413
+ Image : 'image2' ,
414
+ DockerLabels : { Label1 : 'label1' } ,
415
+ FirelensConfiguration : {
416
+ Options : { Name : 'cloudwatch' } ,
417
+ } ,
418
+ LogConfiguration : {
419
+ Options : { Option1 : 'option1' } ,
420
+ } ,
421
+ } ,
422
+ ] ,
423
+ Volumes : [
424
+ {
425
+ DockerVolumeConfiguration : {
426
+ DriverOpts : { Option1 : 'option1' } ,
427
+ Labels : { Label1 : 'label1' } ,
428
+ } ,
429
+ } ,
430
+ ] ,
431
+ } ,
432
+ } ,
433
+ Service : {
434
+ Type : 'AWS::ECS::Service' ,
435
+ Properties : {
436
+ TaskDefinition : { Ref : 'TaskDef' } ,
437
+ } ,
438
+ } ,
439
+ } ,
440
+ } ,
441
+ } ) ;
442
+
443
+ // WHEN
444
+ const deployStackResult = await hotswapMockSdkProvider . tryHotswapDeployment ( cdkStackArtifact ) ;
445
+
446
+ // THEN
447
+ expect ( deployStackResult ) . not . toBeUndefined ( ) ;
448
+ expect ( mockRegisterTaskDef ) . toBeCalledWith ( {
449
+ family : 'my-task-def' ,
450
+ containerDefinitions : [
451
+ {
452
+ image : 'image2' ,
453
+ dockerLabels : { Label1 : 'label1' } ,
454
+ firelensConfiguration : {
455
+ options : {
456
+ Name : 'cloudwatch' ,
457
+ } ,
458
+ } ,
459
+ logConfiguration : {
460
+ options : { Option1 : 'option1' } ,
461
+ } ,
462
+ } ,
463
+ ] ,
464
+ volumes : [
465
+ {
466
+ dockerVolumeConfiguration : {
467
+ driverOpts : { Option1 : 'option1' } ,
468
+ labels : { Label1 : 'label1' } ,
469
+ } ,
470
+ } ,
471
+ ] ,
472
+ } ) ;
473
+ expect ( mockUpdateService ) . toBeCalledWith ( {
474
+ service : 'arn:aws:ecs:region:account:service/my-cluster/my-service' ,
475
+ cluster : 'my-cluster' ,
476
+ taskDefinition : 'arn:aws:ecs:region:account:task-definition/my-task-def:3' ,
477
+ deploymentConfiguration : {
478
+ minimumHealthyPercent : 0 ,
479
+ } ,
480
+ forceNewDeployment : true ,
481
+ } ) ;
482
+ } ) ;
0 commit comments