@@ -9,21 +9,45 @@ import (
99)
1010
1111func TestApplyServiceDefinitionToUpdateInput (t * testing.T ) {
12- updateInput := & ecs.UpdateServiceInput {}
13- applyServiceDefinitionToUpdateInput (updateInput , & ecs.CreateServiceInput {})
12+ t .Run ("preserves nil slice fields" , func (t * testing.T ) {
13+ updateInput := & ecs.UpdateServiceInput {}
14+ applyServiceDefinitionToUpdateInput (updateInput , & ecs.CreateServiceInput {})
1415
15- assert .Equal ( t , []ecstypes. CapacityProviderStrategyItem {} , updateInput .CapacityProviderStrategy )
16- assert .Equal ( t , []ecstypes. LoadBalancer {} , updateInput .LoadBalancers )
17- assert .Equal ( t , []ecstypes. ServiceRegistry {} , updateInput .ServiceRegistries )
18- assert .Equal ( t , []ecstypes. ServiceVolumeConfiguration {} , updateInput .VolumeConfigurations )
19- assert .Equal ( t , []ecstypes. PlacementConstraint {} , updateInput .PlacementConstraints )
20- assert .Equal ( t , []ecstypes. PlacementStrategy {} , updateInput .PlacementStrategy )
21- assert .Equal ( t , []ecstypes. VpcLatticeConfiguration {} , updateInput .VpcLatticeConfigurations )
16+ assert .Nil ( t , updateInput .CapacityProviderStrategy )
17+ assert .Nil ( t , updateInput .LoadBalancers )
18+ assert .Nil ( t , updateInput .ServiceRegistries )
19+ assert .Nil ( t , updateInput .VolumeConfigurations )
20+ assert .Nil ( t , updateInput .PlacementConstraints )
21+ assert .Nil ( t , updateInput .PlacementStrategy )
22+ assert .Nil ( t , updateInput .VpcLatticeConfigurations )
2223
23- assert .Nil (t , updateInput .NetworkConfiguration )
24- assert .Nil (t , updateInput .ServiceConnectConfiguration )
25- assert .Nil (t , updateInput .PlatformVersion )
26- assert .Nil (t , updateInput .DeploymentConfiguration )
27- assert .Nil (t , updateInput .HealthCheckGracePeriodSeconds )
28- assert .Equal (t , ecstypes .PropagateTags ("" ), updateInput .PropagateTags )
24+ assert .Nil (t , updateInput .NetworkConfiguration )
25+ assert .Nil (t , updateInput .ServiceConnectConfiguration )
26+ assert .Nil (t , updateInput .PlatformVersion )
27+ assert .Nil (t , updateInput .DeploymentConfiguration )
28+ assert .Nil (t , updateInput .HealthCheckGracePeriodSeconds )
29+ assert .Equal (t , ecstypes .PropagateTags ("" ), updateInput .PropagateTags )
30+ })
31+
32+ t .Run ("preserves explicit empty slice fields" , func (t * testing.T ) {
33+ serviceInput := & ecs.CreateServiceInput {
34+ CapacityProviderStrategy : []ecstypes.CapacityProviderStrategyItem {},
35+ LoadBalancers : []ecstypes.LoadBalancer {},
36+ ServiceRegistries : []ecstypes.ServiceRegistry {},
37+ VolumeConfigurations : []ecstypes.ServiceVolumeConfiguration {},
38+ PlacementConstraints : []ecstypes.PlacementConstraint {},
39+ PlacementStrategy : []ecstypes.PlacementStrategy {},
40+ VpcLatticeConfigurations : []ecstypes.VpcLatticeConfiguration {},
41+ }
42+ updateInput := & ecs.UpdateServiceInput {}
43+ applyServiceDefinitionToUpdateInput (updateInput , serviceInput )
44+
45+ assert .Equal (t , serviceInput .CapacityProviderStrategy , updateInput .CapacityProviderStrategy )
46+ assert .Equal (t , serviceInput .LoadBalancers , updateInput .LoadBalancers )
47+ assert .Equal (t , serviceInput .ServiceRegistries , updateInput .ServiceRegistries )
48+ assert .Equal (t , serviceInput .VolumeConfigurations , updateInput .VolumeConfigurations )
49+ assert .Equal (t , serviceInput .PlacementConstraints , updateInput .PlacementConstraints )
50+ assert .Equal (t , serviceInput .PlacementStrategy , updateInput .PlacementStrategy )
51+ assert .Equal (t , serviceInput .VpcLatticeConfigurations , updateInput .VpcLatticeConfigurations )
52+ })
2953}
0 commit comments