@@ -182,7 +182,7 @@ var _ = t.Describe("Oci", func() {
182182 Skip ("CRIU is missing or too old." )
183183 }
184184 // Given
185- beforeEach (sandboxID )
185+ beforeEach ()
186186 defer os .RemoveAll ("dump.log" )
187187 config .Runtimes ["runc" ] = & libconfig.RuntimeHandler {
188188 RuntimePath : "/bin/true" ,
@@ -209,7 +209,7 @@ var _ = t.Describe("Oci", func() {
209209 }
210210 // Given
211211 defer os .RemoveAll ("dump.log" )
212- beforeEach (sandboxID )
212+ beforeEach ()
213213 config .Runtimes ["runc" ] = & libconfig.RuntimeHandler {
214214 RuntimePath : "/bin/false" ,
215215 }
@@ -235,57 +235,44 @@ var _ = t.Describe("Oci", func() {
235235 Skip ("CRIU is missing or too old." )
236236 }
237237 // Given
238- beforeEach (sandboxID )
238+ beforeEach ()
239239 config .Runtimes ["runc" ] = & libconfig.RuntimeHandler {
240240 RuntimePath : "/bin/true" ,
241+ MonitorPath : "/bin/true" ,
241242 }
242243
243- specgen := & specs.Spec {
244- Version : "1.0.0" ,
245- }
246244 err := os .Mkdir ("checkpoint" , 0o700 )
247245 Expect (err ).To (BeNil ())
248246 defer os .RemoveAll ("checkpoint" )
249247 inventory , err := os .OpenFile ("checkpoint/inventory.img" , os .O_RDONLY | os .O_CREATE , 0o644 )
250248 Expect (err ).To (BeNil ())
251249 inventory .Close ()
252250
253- // When
254- err = sut .RestoreContainer (context .Background (), myContainer , specgen , 42 , "no-parent-cgroup-exists" )
255-
256- // Then
257- Expect (err ).NotTo (BeNil ())
258- Expect (err .Error ()).To (Equal ("failed to detect destination sandbox of to be restored container containerID" ))
259- })
260- It ("RestoreContainer should fail with destination sandbox detection" , func () {
261- if ! criu .CheckForCriu (criu .PodCriuVersion ) {
262- Skip ("CRIU is missing or too old." )
263- }
264- // Given
265- beforeEach ("" )
266251 specgen := & specs.Spec {
267- Version : "1.0.0" ,
252+ Version : "1.0.0" ,
253+ Annotations : map [string ]string {"io.kubernetes.cri-o.SandboxID" : "sandboxID" },
254+ Linux : & specs.Linux {
255+ MountLabel : "." ,
256+ },
257+ Process : & specs.Process {
258+ SelinuxLabel : "" ,
259+ },
268260 }
269- err := os .Mkdir ("checkpoint" , 0o700 )
270- Expect (err ).To (BeNil ())
271- defer os .RemoveAll ("checkpoint" )
272- inventory , err := os .OpenFile ("checkpoint/inventory.img" , os .O_RDONLY | os .O_CREATE , 0o644 )
273- Expect (err ).To (BeNil ())
274- inventory .Close ()
261+ myContainer .SetSpec (specgen )
275262
276263 // When
277- err = sut .RestoreContainer (context .Background (), myContainer , specgen , 42 , "no-parent-cgroup-exists" )
264+ err = sut .RestoreContainer (context .Background (), myContainer , "no-parent-cgroup-exists" , "label " )
278265
279266 // Then
280267 Expect (err ).NotTo (BeNil ())
281- Expect (err .Error ()).To (Equal ("failed to detect sandbox of to be restored container containerID " ))
268+ Expect (err .Error ()).To (ContainSubstring ("failed" ))
282269 })
283270 It ("RestoreContainer should fail" , func () {
284271 if ! criu .CheckForCriu (criu .PodCriuVersion ) {
285272 Skip ("CRIU is missing or too old." )
286273 }
287274 // Given
288- beforeEach (sandboxID )
275+ beforeEach ()
289276 config .Runtimes ["runc" ] = & libconfig.RuntimeHandler {
290277 RuntimePath : "/bin/true" ,
291278 MonitorPath : "/bin/true" ,
@@ -325,7 +312,7 @@ var _ = t.Describe("Oci", func() {
325312 config .Conmon = "/bin/true"
326313
327314 // When
328- err = sut .RestoreContainer (context .Background (), myContainer , specgen , 42 , "no-parent-cgroup-exists" )
315+ err = sut .RestoreContainer (context .Background (), myContainer , "no-parent-cgroup-exists" , "label " )
329316 defer os .RemoveAll ("restore.log" )
330317
331318 // Then
@@ -337,16 +324,9 @@ var _ = t.Describe("Oci", func() {
337324 Skip ("CRIU is missing or too old." )
338325 }
339326 // Given
340- beforeEach (sandboxID )
341- specgen := & specs.Spec {
342- Version : "1.0.0" ,
343- Annotations : map [string ]string {"io.kubernetes.cri-o.SandboxID" : "sandboxID" },
344- Linux : & specs.Linux {
345- MountLabel : "." ,
346- },
347- }
327+ beforeEach ()
348328 // When
349- err := sut .RestoreContainer (context .Background (), myContainer , specgen , 42 , "no-parent-cgroup-exists" )
329+ err := sut .RestoreContainer (context .Background (), myContainer , "no-parent-cgroup-exists" , "label " )
350330
351331 // Then
352332 Expect (err ).NotTo (BeNil ())
0 commit comments