@@ -255,7 +255,7 @@ func TestContainerCapabilities(t *testing.T) {
255
255
c .allCaps = allCaps
256
256
257
257
containerConfig .Linux .SecurityContext .Capabilities = test .capability
258
- spec , err := c .buildContainerSpec (currentPlatform , testID , testSandboxID , testPid , "" , testContainerName , testImageName , containerConfig , sandboxConfig , imageConfig , nil , ociRuntime )
258
+ spec , err := c .buildContainerSpec (currentPlatform , testID , testSandboxID , testPid , "" , testContainerName , testImageName , containerConfig , sandboxConfig , imageConfig , nil , ociRuntime , nil )
259
259
require .NoError (t , err )
260
260
261
261
if selinux .GetEnabled () {
@@ -290,7 +290,7 @@ func TestContainerSpecTty(t *testing.T) {
290
290
c := newTestCRIService ()
291
291
for _ , tty := range []bool {true , false } {
292
292
containerConfig .Tty = tty
293
- spec , err := c .buildContainerSpec (currentPlatform , testID , testSandboxID , testPid , "" , testContainerName , testImageName , containerConfig , sandboxConfig , imageConfig , nil , ociRuntime )
293
+ spec , err := c .buildContainerSpec (currentPlatform , testID , testSandboxID , testPid , "" , testContainerName , testImageName , containerConfig , sandboxConfig , imageConfig , nil , ociRuntime , nil )
294
294
require .NoError (t , err )
295
295
specCheck (t , testID , testSandboxID , testPid , spec )
296
296
assert .Equal (t , tty , spec .Process .Terminal )
@@ -317,7 +317,7 @@ func TestContainerSpecDefaultPath(t *testing.T) {
317
317
imageConfig .Env = append (imageConfig .Env , pathenv )
318
318
expected = pathenv
319
319
}
320
- spec , err := c .buildContainerSpec (currentPlatform , testID , testSandboxID , testPid , "" , testContainerName , testImageName , containerConfig , sandboxConfig , imageConfig , nil , ociRuntime )
320
+ spec , err := c .buildContainerSpec (currentPlatform , testID , testSandboxID , testPid , "" , testContainerName , testImageName , containerConfig , sandboxConfig , imageConfig , nil , ociRuntime , nil )
321
321
require .NoError (t , err )
322
322
specCheck (t , testID , testSandboxID , testPid , spec )
323
323
assert .Contains (t , spec .Process .Env , expected )
@@ -334,7 +334,7 @@ func TestContainerSpecReadonlyRootfs(t *testing.T) {
334
334
c := newTestCRIService ()
335
335
for _ , readonly := range []bool {true , false } {
336
336
containerConfig .Linux .SecurityContext .ReadonlyRootfs = readonly
337
- spec , err := c .buildContainerSpec (currentPlatform , testID , testSandboxID , testPid , "" , testContainerName , testImageName , containerConfig , sandboxConfig , imageConfig , nil , ociRuntime )
337
+ spec , err := c .buildContainerSpec (currentPlatform , testID , testSandboxID , testPid , "" , testContainerName , testImageName , containerConfig , sandboxConfig , imageConfig , nil , ociRuntime , nil )
338
338
require .NoError (t , err )
339
339
specCheck (t , testID , testSandboxID , testPid , spec )
340
340
assert .Equal (t , readonly , spec .Root .Readonly )
@@ -368,7 +368,7 @@ func TestContainerSpecWithExtraMounts(t *testing.T) {
368
368
Readonly : false ,
369
369
},
370
370
}
371
- spec , err := c .buildContainerSpec (currentPlatform , testID , testSandboxID , testPid , "" , testContainerName , testImageName , containerConfig , sandboxConfig , imageConfig , extraMounts , ociRuntime )
371
+ spec , err := c .buildContainerSpec (currentPlatform , testID , testSandboxID , testPid , "" , testContainerName , testImageName , containerConfig , sandboxConfig , imageConfig , extraMounts , ociRuntime , nil )
372
372
require .NoError (t , err )
373
373
specCheck (t , testID , testSandboxID , testPid , spec )
374
374
var mounts , sysMounts []runtimespec.Mount
@@ -435,7 +435,7 @@ func TestContainerAndSandboxPrivileged(t *testing.T) {
435
435
sandboxConfig .Linux .SecurityContext = & runtime.LinuxSandboxSecurityContext {
436
436
Privileged : test .sandboxPrivileged ,
437
437
}
438
- _ , err := c .buildContainerSpec (currentPlatform , testID , testSandboxID , testPid , "" , testContainerName , testImageName , containerConfig , sandboxConfig , imageConfig , nil , ociRuntime )
438
+ _ , err := c .buildContainerSpec (currentPlatform , testID , testSandboxID , testPid , "" , testContainerName , testImageName , containerConfig , sandboxConfig , imageConfig , nil , ociRuntime , nil )
439
439
if test .expectError {
440
440
assert .Error (t , err )
441
441
} else {
@@ -476,7 +476,7 @@ func TestPrivilegedBindMount(t *testing.T) {
476
476
containerConfig .Linux .SecurityContext .Privileged = test .privileged
477
477
sandboxConfig .Linux .SecurityContext .Privileged = test .privileged
478
478
479
- spec , err := c .buildContainerSpec (currentPlatform , t .Name (), testSandboxID , testPid , "" , testContainerName , testImageName , containerConfig , sandboxConfig , imageConfig , nil , ociRuntime )
479
+ spec , err := c .buildContainerSpec (currentPlatform , t .Name (), testSandboxID , testPid , "" , testContainerName , testImageName , containerConfig , sandboxConfig , imageConfig , nil , ociRuntime , nil )
480
480
481
481
assert .NoError (t , err )
482
482
if test .expectedSysFSRO {
@@ -597,7 +597,7 @@ func TestMountPropagation(t *testing.T) {
597
597
var spec runtimespec.Spec
598
598
spec .Linux = & runtimespec.Linux {}
599
599
600
- err := opts .WithMounts (c .os , config , []* runtime.Mount {test .criMount }, "" )(context .Background (), nil , nil , & spec )
600
+ err := opts .WithMounts (c .os , config , []* runtime.Mount {test .criMount }, "" , nil )(context .Background (), nil , nil , & spec )
601
601
if test .expectErr {
602
602
require .Error (t , err )
603
603
} else {
@@ -648,7 +648,7 @@ func TestPidNamespace(t *testing.T) {
648
648
test := test
649
649
t .Run (test .desc , func (t * testing.T ) {
650
650
containerConfig .Linux .SecurityContext .NamespaceOptions = & runtime.NamespaceOption {Pid : test .pidNS }
651
- spec , err := c .buildContainerSpec (currentPlatform , testID , testSandboxID , testPid , "" , testContainerName , testImageName , containerConfig , sandboxConfig , imageConfig , nil , ociRuntime )
651
+ spec , err := c .buildContainerSpec (currentPlatform , testID , testSandboxID , testPid , "" , testContainerName , testImageName , containerConfig , sandboxConfig , imageConfig , nil , ociRuntime , nil )
652
652
require .NoError (t , err )
653
653
assert .Contains (t , spec .Linux .Namespaces , test .expected )
654
654
})
@@ -823,7 +823,7 @@ func TestUserNamespace(t *testing.T) {
823
823
sandboxUserns = test .sandboxUserNS
824
824
}
825
825
sandboxConfig .Linux .SecurityContext .NamespaceOptions = & runtime.NamespaceOption {UsernsOptions : sandboxUserns }
826
- spec , err := c .buildContainerSpec (currentPlatform , testID , testSandboxID , testPid , "" , testContainerName , testImageName , containerConfig , sandboxConfig , imageConfig , nil , ociRuntime )
826
+ spec , err := c .buildContainerSpec (currentPlatform , testID , testSandboxID , testPid , "" , testContainerName , testImageName , containerConfig , sandboxConfig , imageConfig , nil , ociRuntime , nil )
827
827
828
828
if test .err {
829
829
require .Error (t , err )
@@ -853,7 +853,7 @@ func TestNoDefaultRunMount(t *testing.T) {
853
853
ociRuntime := config.Runtime {}
854
854
c := newTestCRIService ()
855
855
856
- spec , err := c .buildContainerSpec (currentPlatform , testID , testSandboxID , testPid , "" , testContainerName , testImageName , containerConfig , sandboxConfig , imageConfig , nil , ociRuntime )
856
+ spec , err := c .buildContainerSpec (currentPlatform , testID , testSandboxID , testPid , "" , testContainerName , testImageName , containerConfig , sandboxConfig , imageConfig , nil , ociRuntime , nil )
857
857
assert .NoError (t , err )
858
858
for _ , mount := range spec .Mounts {
859
859
assert .NotEqual (t , "/run" , mount .Destination )
@@ -1282,7 +1282,7 @@ func TestMaskedAndReadonlyPaths(t *testing.T) {
1282
1282
sandboxConfig .Linux .SecurityContext = & runtime.LinuxSandboxSecurityContext {
1283
1283
Privileged : test .privileged ,
1284
1284
}
1285
- spec , err := c .buildContainerSpec (currentPlatform , testID , testSandboxID , testPid , "" , testContainerName , testImageName , containerConfig , sandboxConfig , imageConfig , nil , ociRuntime )
1285
+ spec , err := c .buildContainerSpec (currentPlatform , testID , testSandboxID , testPid , "" , testContainerName , testImageName , containerConfig , sandboxConfig , imageConfig , nil , ociRuntime , nil )
1286
1286
require .NoError (t , err )
1287
1287
if ! test .privileged { // specCheck presumes an unprivileged container
1288
1288
specCheck (t , testID , testSandboxID , testPid , spec )
@@ -1335,7 +1335,7 @@ func TestHostname(t *testing.T) {
1335
1335
sandboxConfig .Linux .SecurityContext = & runtime.LinuxSandboxSecurityContext {
1336
1336
NamespaceOptions : & runtime.NamespaceOption {Network : test .networkNs },
1337
1337
}
1338
- spec , err := c .buildContainerSpec (currentPlatform , testID , testSandboxID , testPid , "" , testContainerName , testImageName , containerConfig , sandboxConfig , imageConfig , nil , ociRuntime )
1338
+ spec , err := c .buildContainerSpec (currentPlatform , testID , testSandboxID , testPid , "" , testContainerName , testImageName , containerConfig , sandboxConfig , imageConfig , nil , ociRuntime , nil )
1339
1339
require .NoError (t , err )
1340
1340
specCheck (t , testID , testSandboxID , testPid , spec )
1341
1341
assert .Contains (t , spec .Process .Env , test .expectedEnv )
@@ -1348,7 +1348,7 @@ func TestDisableCgroup(t *testing.T) {
1348
1348
ociRuntime := config.Runtime {}
1349
1349
c := newTestCRIService ()
1350
1350
c .config .DisableCgroup = true
1351
- spec , err := c .buildContainerSpec (currentPlatform , "test-id" , "sandbox-id" , 1234 , "" , "container-name" , testImageName , containerConfig , sandboxConfig , imageConfig , nil , ociRuntime )
1351
+ spec , err := c .buildContainerSpec (currentPlatform , "test-id" , "sandbox-id" , 1234 , "" , "container-name" , testImageName , containerConfig , sandboxConfig , imageConfig , nil , ociRuntime , nil )
1352
1352
require .NoError (t , err )
1353
1353
1354
1354
t .Log ("resource limit should not be set" )
@@ -1503,7 +1503,7 @@ additional-group-for-root:x:22222:root
1503
1503
containerConfig .Linux .SecurityContext = test .securityContext
1504
1504
imageConfig .User = test .imageConfigUser
1505
1505
1506
- spec , err := c .buildContainerSpec (currentPlatform , testID , testSandboxID , testPid , "" , testContainerName , testImageName , containerConfig , sandboxConfig , imageConfig , nil , ociRuntime )
1506
+ spec , err := c .buildContainerSpec (currentPlatform , testID , testSandboxID , testPid , "" , testContainerName , testImageName , containerConfig , sandboxConfig , imageConfig , nil , ociRuntime , nil )
1507
1507
require .NoError (t , err )
1508
1508
1509
1509
spec .Root .Path = tempRootDir // simulating /etc/{passwd, group}
@@ -1579,7 +1579,7 @@ func TestNonRootUserAndDevices(t *testing.T) {
1579
1579
},
1580
1580
}
1581
1581
1582
- spec , err := c .buildContainerSpec (currentPlatform , t .Name (), testSandboxID , testPid , "" , testContainerName , testImageName , containerConfig , sandboxConfig , imageConfig , nil , config.Runtime {})
1582
+ spec , err := c .buildContainerSpec (currentPlatform , t .Name (), testSandboxID , testPid , "" , testContainerName , testImageName , containerConfig , sandboxConfig , imageConfig , nil , config.Runtime {}, nil )
1583
1583
assert .NoError (t , err )
1584
1584
1585
1585
assert .Equal (t , test .expectedDeviceUID , * spec .Linux .Devices [0 ].UID )
@@ -1653,7 +1653,7 @@ func TestPrivilegedDevices(t *testing.T) {
1653
1653
PrivilegedWithoutHostDevices : test .privilegedWithoutHostDevices ,
1654
1654
PrivilegedWithoutHostDevicesAllDevicesAllowed : test .privilegedWithoutHostDevicesAllDevicesAllowed ,
1655
1655
}
1656
- spec , err := c .buildContainerSpec (currentPlatform , t .Name (), testSandboxID , testPid , "" , testContainerName , testImageName , containerConfig , sandboxConfig , imageConfig , nil , ociRuntime )
1656
+ spec , err := c .buildContainerSpec (currentPlatform , t .Name (), testSandboxID , testPid , "" , testContainerName , testImageName , containerConfig , sandboxConfig , imageConfig , nil , ociRuntime , nil )
1657
1657
assert .NoError (t , err )
1658
1658
1659
1659
hostDevicesRaw , err := oci .HostDevices ()
@@ -1708,7 +1708,7 @@ func TestBaseOCISpec(t *testing.T) {
1708
1708
testPid := uint32 (1234 )
1709
1709
containerConfig , sandboxConfig , imageConfig , specCheck := getCreateContainerTestData ()
1710
1710
1711
- spec , err := c .buildContainerSpec (currentPlatform , testID , testSandboxID , testPid , "" , testContainerName , testImageName , containerConfig , sandboxConfig , imageConfig , nil , ociRuntime )
1711
+ spec , err := c .buildContainerSpec (currentPlatform , testID , testSandboxID , testPid , "" , testContainerName , testImageName , containerConfig , sandboxConfig , imageConfig , nil , ociRuntime , nil )
1712
1712
assert .NoError (t , err )
1713
1713
1714
1714
specCheck (t , testID , testSandboxID , testPid , spec )
@@ -2040,7 +2040,7 @@ containerEdits:
2040
2040
},
2041
2041
} {
2042
2042
t .Run (test .description , func (t * testing.T ) {
2043
- spec , err := c .buildContainerSpec (currentPlatform , testID , testSandboxID , testPid , "" , testContainerName , testImageName , containerConfig , sandboxConfig , imageConfig , nil , ociRuntime )
2043
+ spec , err := c .buildContainerSpec (currentPlatform , testID , testSandboxID , testPid , "" , testContainerName , testImageName , containerConfig , sandboxConfig , imageConfig , nil , ociRuntime , nil )
2044
2044
require .NoError (t , err )
2045
2045
2046
2046
specCheck (t , testID , testSandboxID , testPid , spec )
0 commit comments