@@ -222,7 +222,6 @@ var sampleConfig = types.Config{
222222 Networks : map [string ]* types.ServiceNetworkConfig {
223223 "with_me" : nil ,
224224 },
225- Scale : 1 ,
226225 },
227226 {
228227 Name : "bar" ,
@@ -231,7 +230,6 @@ var sampleConfig = types.Config{
231230 Networks : map [string ]* types.ServiceNetworkConfig {
232231 "with_ipam" : nil ,
233232 },
234- Scale : 1 ,
235233 },
236234 },
237235 Networks : map [string ]types.NetworkConfig {
@@ -817,7 +815,7 @@ networks:
817815 Disable : true ,
818816 },
819817 Deploy : & types.DeployConfig {
820- Replicas : uint64Ptr (555 ),
818+ Replicas : intPtr (555 ),
821819 UpdateConfig : & types.UpdateConfig {
822820 Parallelism : uint64Ptr (555 ),
823821 MaxFailureRatio : 3.14 ,
@@ -844,7 +842,6 @@ networks:
844842 },
845843 Privileged : true ,
846844 ReadOnly : true ,
847- Scale : 1 ,
848845 ShmSize : types .UnitBytes (2 * 1024 * 1024 * 1024 ),
849846 StopGracePeriod : & typesDuration ,
850847 StdinOpen : true ,
@@ -1054,14 +1051,18 @@ services:
10541051` , map [string ]string {"FOO_SCALE" : "2" })
10551052
10561053 assert .NilError (t , err )
1057- assert .Equal (t , project .Services [0 ].Scale , 2 )
1054+ assert .Equal (t , * project .Services [0 ].Scale , 2 )
10581055}
10591056
10601057func durationPtr (value time.Duration ) * types.Duration {
10611058 result := types .Duration (value )
10621059 return & result
10631060}
10641061
1062+ func intPtr (value int ) * int {
1063+ return & value
1064+ }
1065+
10651066func uint64Ptr (value uint64 ) * uint64 {
10661067 return & value
10671068}
@@ -1583,7 +1584,6 @@ networks:
15831584 {
15841585 Name : "hello-world" ,
15851586 Image : "redis:alpine" ,
1586- Scale : 1 ,
15871587 Networks : map [string ]* types.ServiceNetworkConfig {
15881588 "network1" : nil ,
15891589 "network3" : nil ,
@@ -1634,7 +1634,6 @@ networks:
16341634 {
16351635 Name : "foo" ,
16361636 Image : "alpine" ,
1637- Scale : 1 ,
16381637 Networks : map [string ]* types.ServiceNetworkConfig {
16391638 "network1" : {
16401639 Ipv4Address : "10.1.0.100" ,
@@ -1796,7 +1795,6 @@ secrets:
17961795 Source : "config" ,
17971796 },
17981797 },
1799- Scale : 1 ,
18001798 Secrets : []types.ServiceSecretConfig {
18011799 {
18021800 Source : "secret" ,
@@ -1866,7 +1864,6 @@ secrets:
18661864 Source : "config" ,
18671865 },
18681866 },
1869- Scale : 1 ,
18701867 Secrets : []types.ServiceSecretConfig {
18711868 {
18721869 Source : "secret" ,
@@ -1952,7 +1949,6 @@ func TestLoadWithExtends(t *testing.T) {
19521949 Target : "/var/lib/mysql" ,
19531950 Bind : & types.ServiceVolumeBind {CreateHostPath : true },
19541951 }},
1955- Scale : 1 ,
19561952 },
19571953 }
19581954 assert .Check (t , is .DeepEqual (expServices , actual .Services ))
@@ -1982,7 +1978,6 @@ func TestLoadWithExtendsWithContextUrl(t *testing.T) {
19821978 },
19831979 Environment : types.MappingWithEquals {},
19841980 Networks : map [string ]* types.ServiceNetworkConfig {"default" : nil },
1985- Scale : 1 ,
19861981 },
19871982 }
19881983 assert .Check (t , is .DeepEqual (expServices , actual .Services ))
@@ -2348,7 +2343,6 @@ func TestDeviceWriteBps(t *testing.T) {
23482343 Name : "foo" ,
23492344 Image : "busybox" ,
23502345 Environment : types.MappingWithEquals {},
2351- Scale : 1 ,
23522346 BlkioConfig : & types.BlkioConfig {
23532347 DeviceReadBps : []types.ThrottleDevice {
23542348 {
@@ -2392,7 +2386,6 @@ volumes:
23922386 Name : "foo" ,
23932387 Image : "busybox" ,
23942388 Environment : types.MappingWithEquals {},
2395- Scale : 1 ,
23962389 Volumes : []types.ServiceVolumeConfig {
23972390 {
23982391 Type : types .VolumeTypeVolume ,
@@ -2418,7 +2411,6 @@ services:
24182411 Name : "x-foo" ,
24192412 Image : "busybox" ,
24202413 Environment : types.MappingWithEquals {},
2421- Scale : 1 ,
24222414 },
24232415 })
24242416}
@@ -2448,7 +2440,6 @@ services:
24482440 Name : "foo" ,
24492441 Image : "busybox" ,
24502442 Environment : types.MappingWithEquals {},
2451- Scale : 1 ,
24522443 DependsOn : types.DependsOnConfig {"imported" : {Condition : "service_started" , Required : true }},
24532444 },
24542445 {
@@ -2459,7 +2450,6 @@ services:
24592450 filepath .Join (workingDir , "testdata" , "subdir" , "extra.env" ),
24602451 },
24612452 Image : "nginx" ,
2462- Scale : 1 ,
24632453 Volumes : []types.ServiceVolumeConfig {
24642454 {
24652455 Type : "bind" ,
@@ -2586,7 +2576,6 @@ services:
25862576 Name : "foo" ,
25872577 Image : "nginx" ,
25882578 Environment : types.MappingWithEquals {},
2589- Scale : 1 ,
25902579 DependsOn : types.DependsOnConfig {
25912580 "bar" : {Condition : types .ServiceConditionStarted , Required : true },
25922581 "baz" : {Condition : types .ServiceConditionHealthy , Required : false },
@@ -2640,7 +2629,6 @@ services:
26402629 EnvFile : types.StringList {
26412630 filepath .Join (config .WorkingDir , "testdata" , "remote" , "env" ),
26422631 },
2643- Scale : 1 ,
26442632 Volumes : []types.ServiceVolumeConfig {
26452633 {
26462634 Type : types .VolumeTypeBind ,
@@ -2833,8 +2821,12 @@ services:
28332821 memswap_limit: 640kb
28342822` )
28352823 assert .NilError (t , err )
2836- assert .Equal (t , project .Services [0 ].MemSwapLimit , types .UnitBytes (- 1 ))
2837- assert .Equal (t , project .Services [1 ].MemSwapLimit , types .UnitBytes (640 * 1024 ))
2824+ test1 , err := project .GetService ("test1" )
2825+ assert .NilError (t , err )
2826+ assert .Equal (t , test1 .MemSwapLimit , types .UnitBytes (- 1 ))
2827+ test2 , err := project .GetService ("test2" )
2828+ assert .NilError (t , err )
2829+ assert .Equal (t , test2 .MemSwapLimit , types .UnitBytes (640 * 1024 ))
28382830}
28392831
28402832func TestBuildUlimits (t * testing.T ) {
0 commit comments