@@ -40,7 +40,7 @@ func testExecPS(t *testing.T, userns bool) {
40
40
}
41
41
config := newTemplateConfig (t , & tParam {userns : userns })
42
42
43
- buffers , exitCode , err := runContainer (t , config , "" , " ps" , "-o" , "pid,user,comm" )
43
+ buffers , exitCode , err := runContainer (t , config , "ps" , "-o" , "pid,user,comm" )
44
44
if err != nil {
45
45
t .Fatalf ("%s: %s" , buffers , err )
46
46
}
@@ -67,7 +67,7 @@ func TestIPCPrivate(t *testing.T) {
67
67
ok (t , err )
68
68
69
69
config := newTemplateConfig (t , nil )
70
- buffers , exitCode , err := runContainer (t , config , "" , " readlink" , "/proc/self/ns/ipc" )
70
+ buffers , exitCode , err := runContainer (t , config , "readlink" , "/proc/self/ns/ipc" )
71
71
ok (t , err )
72
72
73
73
if exitCode != 0 {
@@ -89,7 +89,7 @@ func TestIPCHost(t *testing.T) {
89
89
90
90
config := newTemplateConfig (t , nil )
91
91
config .Namespaces .Remove (configs .NEWIPC )
92
- buffers , exitCode , err := runContainer (t , config , "" , " readlink" , "/proc/self/ns/ipc" )
92
+ buffers , exitCode , err := runContainer (t , config , "readlink" , "/proc/self/ns/ipc" )
93
93
ok (t , err )
94
94
95
95
if exitCode != 0 {
@@ -112,7 +112,7 @@ func TestIPCJoinPath(t *testing.T) {
112
112
config := newTemplateConfig (t , nil )
113
113
config .Namespaces .Add (configs .NEWIPC , "/proc/1/ns/ipc" )
114
114
115
- buffers , exitCode , err := runContainer (t , config , "" , " readlink" , "/proc/self/ns/ipc" )
115
+ buffers , exitCode , err := runContainer (t , config , "readlink" , "/proc/self/ns/ipc" )
116
116
ok (t , err )
117
117
118
118
if exitCode != 0 {
@@ -132,7 +132,7 @@ func TestIPCBadPath(t *testing.T) {
132
132
config := newTemplateConfig (t , nil )
133
133
config .Namespaces .Add (configs .NEWIPC , "/proc/1/ns/ipcc" )
134
134
135
- if _ , _ , err := runContainer (t , config , "" , " true" ); err == nil {
135
+ if _ , _ , err := runContainer (t , config , "true" ); err == nil {
136
136
t .Fatal ("container succeeded with bad ipc path" )
137
137
}
138
138
}
@@ -163,7 +163,7 @@ func testRlimit(t *testing.T, userns bool) {
163
163
Cur : 1024 ,
164
164
}))
165
165
166
- out , _ , err := runContainer (t , config , "" , " /bin/sh" , "-c" , "ulimit -n" )
166
+ out , _ , err := runContainer (t , config , "/bin/sh" , "-c" , "ulimit -n" )
167
167
ok (t , err )
168
168
if limit := strings .TrimSpace (out .Stdout .String ()); limit != "1025" {
169
169
t .Fatalf ("expected rlimit to be 1025, got %s" , limit )
@@ -537,7 +537,7 @@ func testCpuShares(t *testing.T, systemd bool) {
537
537
config := newTemplateConfig (t , & tParam {systemd : systemd })
538
538
config .Cgroups .Resources .CpuShares = 1
539
539
540
- if _ , _ , err := runContainer (t , config , "" , " ps" ); err == nil {
540
+ if _ , _ , err := runContainer (t , config , "ps" ); err == nil {
541
541
t .Fatalf ("runContainer should failed with invalid CpuShares" )
542
542
}
543
543
}
@@ -562,7 +562,7 @@ func testPids(t *testing.T, systemd bool) {
562
562
config .Cgroups .Resources .PidsLimit = - 1
563
563
564
564
// Running multiple processes.
565
- _ , ret , err := runContainer (t , config , "" , " /bin/sh" , "-c" , "/bin/true | /bin/true | /bin/true | /bin/true" )
565
+ _ , ret , err := runContainer (t , config , "/bin/sh" , "-c" , "/bin/true | /bin/true | /bin/true | /bin/true" )
566
566
ok (t , err )
567
567
568
568
if ret != 0 {
@@ -572,7 +572,7 @@ func testPids(t *testing.T, systemd bool) {
572
572
// Enforce a permissive limit. This needs to be fairly hand-wavey due to the
573
573
// issues with running Go binaries with pids restrictions (see below).
574
574
config .Cgroups .Resources .PidsLimit = 64
575
- _ , ret , err = runContainer (t , config , "" , " /bin/sh" , "-c" , `
575
+ _ , ret , err = runContainer (t , config , "/bin/sh" , "-c" , `
576
576
/bin/true | /bin/true | /bin/true | /bin/true | /bin/true | /bin/true | bin/true | /bin/true |
577
577
/bin/true | /bin/true | /bin/true | /bin/true | /bin/true | /bin/true | bin/true | /bin/true |
578
578
/bin/true | /bin/true | /bin/true | /bin/true | /bin/true | /bin/true | bin/true | /bin/true |
@@ -586,7 +586,7 @@ func testPids(t *testing.T, systemd bool) {
586
586
// Enforce a restrictive limit. 64 * /bin/true + 1 * shell should cause this
587
587
// to fail reliability.
588
588
config .Cgroups .Resources .PidsLimit = 64
589
- out , _ , err := runContainer (t , config , "" , " /bin/sh" , "-c" , `
589
+ out , _ , err := runContainer (t , config , "/bin/sh" , "-c" , `
590
590
/bin/true | /bin/true | /bin/true | /bin/true | /bin/true | /bin/true | bin/true | /bin/true |
591
591
/bin/true | /bin/true | /bin/true | /bin/true | /bin/true | /bin/true | bin/true | /bin/true |
592
592
/bin/true | /bin/true | /bin/true | /bin/true | /bin/true | /bin/true | bin/true | /bin/true |
@@ -632,7 +632,7 @@ func testCgroupResourcesUnifiedErrorOnV1(t *testing.T, systemd bool) {
632
632
config .Cgroups .Resources .Unified = map [string ]string {
633
633
"memory.min" : "10240" ,
634
634
}
635
- _ , _ , err := runContainer (t , config , "" , " true" )
635
+ _ , _ , err := runContainer (t , config , "true" )
636
636
if ! strings .Contains (err .Error (), cgroups .ErrV1NoUnified .Error ()) {
637
637
t .Fatalf ("expected error to contain %v, got %v" , cgroups .ErrV1NoUnified , err )
638
638
}
@@ -716,7 +716,7 @@ func testCgroupResourcesUnified(t *testing.T, systemd bool) {
716
716
717
717
for _ , tc := range testCases {
718
718
config .Cgroups .Resources .Unified = tc .cfg
719
- buffers , ret , err := runContainer (t , config , "" , tc .cmd ... )
719
+ buffers , ret , err := runContainer (t , config , tc .cmd ... )
720
720
if tc .expError != "" {
721
721
if err == nil {
722
722
t .Errorf ("case %q failed: expected error, got nil" , tc .name )
@@ -934,7 +934,7 @@ func TestMountCgroupRO(t *testing.T) {
934
934
return
935
935
}
936
936
config := newTemplateConfig (t , nil )
937
- buffers , exitCode , err := runContainer (t , config , "" , " mount" )
937
+ buffers , exitCode , err := runContainer (t , config , "mount" )
938
938
if err != nil {
939
939
t .Fatalf ("%s: %s" , buffers , err )
940
940
}
@@ -981,7 +981,7 @@ func TestMountCgroupRW(t *testing.T) {
981
981
}
982
982
}
983
983
984
- buffers , exitCode , err := runContainer (t , config , "" , " mount" )
984
+ buffers , exitCode , err := runContainer (t , config , "mount" )
985
985
if err != nil {
986
986
t .Fatalf ("%s: %s" , buffers , err )
987
987
}
@@ -1198,7 +1198,7 @@ func TestSTDIOPermissions(t *testing.T) {
1198
1198
}
1199
1199
1200
1200
config := newTemplateConfig (t , nil )
1201
- buffers , exitCode , err := runContainer (t , config , "" , " sh" , "-c" , "echo hi > /dev/stderr" )
1201
+ buffers , exitCode , err := runContainer (t , config , "sh" , "-c" , "echo hi > /dev/stderr" )
1202
1202
ok (t , err )
1203
1203
if exitCode != 0 {
1204
1204
t .Fatalf ("exit code not 0. code %d stderr %q" , exitCode , buffers .Stderr )
@@ -1446,7 +1446,7 @@ func TestPIDHost(t *testing.T) {
1446
1446
1447
1447
config := newTemplateConfig (t , nil )
1448
1448
config .Namespaces .Remove (configs .NEWPID )
1449
- buffers , exitCode , err := runContainer (t , config , "" , " readlink" , "/proc/self/ns/pid" )
1449
+ buffers , exitCode , err := runContainer (t , config , "readlink" , "/proc/self/ns/pid" )
1450
1450
ok (t , err )
1451
1451
1452
1452
if exitCode != 0 {
@@ -1740,7 +1740,7 @@ func TestCGROUPPrivate(t *testing.T) {
1740
1740
1741
1741
config := newTemplateConfig (t , nil )
1742
1742
config .Namespaces .Add (configs .NEWCGROUP , "" )
1743
- buffers , exitCode , err := runContainer (t , config , "" , " readlink" , "/proc/self/ns/cgroup" )
1743
+ buffers , exitCode , err := runContainer (t , config , "readlink" , "/proc/self/ns/cgroup" )
1744
1744
ok (t , err )
1745
1745
1746
1746
if exitCode != 0 {
@@ -1764,7 +1764,7 @@ func TestCGROUPHost(t *testing.T) {
1764
1764
ok (t , err )
1765
1765
1766
1766
config := newTemplateConfig (t , nil )
1767
- buffers , exitCode , err := runContainer (t , config , "" , " readlink" , "/proc/self/ns/cgroup" )
1767
+ buffers , exitCode , err := runContainer (t , config , "readlink" , "/proc/self/ns/cgroup" )
1768
1768
ok (t , err )
1769
1769
1770
1770
if exitCode != 0 {
@@ -1801,7 +1801,7 @@ func testFdLeaks(t *testing.T, systemd bool) {
1801
1801
ok (t , err )
1802
1802
1803
1803
config := newTemplateConfig (t , & tParam {systemd : systemd })
1804
- buffers , exitCode , err := runContainer (t , config , "" , " true" )
1804
+ buffers , exitCode , err := runContainer (t , config , "true" )
1805
1805
ok (t , err )
1806
1806
1807
1807
if exitCode != 0 {
0 commit comments