@@ -287,7 +287,7 @@ func interrupt(ctx context.Context, t *testing.T, started <-chan int) {
287
287
}
288
288
}
289
289
290
- // dummySleepRunc creates s simple script that just runs `sleep 10` to replace
290
+ // dummySleepRunc creates a simple script that just runs `sleep 10` to replace
291
291
// runc for testing process that are longer running.
292
292
func dummySleepRunc () (_ string , err error ) {
293
293
fh , err := os .CreateTemp ("" , "*.sh" )
@@ -314,6 +314,23 @@ func dummySleepRunc() (_ string, err error) {
314
314
return fh .Name (), nil
315
315
}
316
316
317
+ func TestRuncCheckpoint (t * testing.T ) {
318
+ ctx , cancel := context .WithCancel (context .Background ())
319
+ defer cancel ()
320
+
321
+ okRunc := & Runc {
322
+ Command : "/bin/true" ,
323
+ }
324
+
325
+ opts := & CheckpointOpts {
326
+ AutoDedup : true ,
327
+ }
328
+ err := okRunc .Checkpoint (ctx , "fake-id" , opts )
329
+ if err != nil {
330
+ t .Fatalf ("unexpected error from Checkpoint: %v" , err )
331
+ }
332
+ }
333
+
317
334
func TestCreateArgs (t * testing.T ) {
318
335
o := & CreateOpts {}
319
336
args , err := o .args ()
@@ -336,6 +353,24 @@ func TestCreateArgs(t *testing.T) {
336
353
}
337
354
}
338
355
356
+ func TestCheckpointArgs (t * testing.T ) {
357
+ o := & CheckpointOpts {}
358
+ args := o .args ()
359
+ if len (args ) != 0 {
360
+ t .Fatal ("args should be empty" )
361
+ }
362
+ o = & CheckpointOpts {
363
+ AutoDedup : true ,
364
+ }
365
+ args = o .args ()
366
+ if len (args ) != 1 {
367
+ t .Fatal ("args should have 1 arg" )
368
+ }
369
+ if actual := args [0 ]; actual != "--auto-dedup" {
370
+ t .Fatalf ("arg should be --auto-dedup but got %s" , actual )
371
+ }
372
+ }
373
+
339
374
func TestRuncFeatures (t * testing.T ) {
340
375
ctx := context .Background ()
341
376
if _ , err := exec .LookPath (DefaultCommand ); err != nil {
0 commit comments