@@ -287,7 +287,7 @@ func interrupt(ctx context.Context, t *testing.T, started <-chan int) {
287287 }
288288}
289289
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
291291// runc for testing process that are longer running.
292292func dummySleepRunc () (_ string , err error ) {
293293 fh , err := os .CreateTemp ("" , "*.sh" )
@@ -314,6 +314,23 @@ func dummySleepRunc() (_ string, err error) {
314314 return fh .Name (), nil
315315}
316316
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+
317334func TestCreateArgs (t * testing.T ) {
318335 o := & CreateOpts {}
319336 args , err := o .args ()
@@ -336,6 +353,24 @@ func TestCreateArgs(t *testing.T) {
336353 }
337354}
338355
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+
339374func TestRuncFeatures (t * testing.T ) {
340375 ctx := context .Background ()
341376 if _ , err := exec .LookPath (DefaultCommand ); err != nil {
0 commit comments