From 304fc470f495b47d1b55168c8737a9db1e5083d6 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Tue, 6 Jun 2017 14:18:59 -0700 Subject: [PATCH] Only run checkpoint test if criu is installed Signed-off-by: Michael Crosby --- checkpoint_test.go | 6 ++++++ client_test.go | 10 ++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/checkpoint_test.go b/checkpoint_test.go index 3315ab152..2f3a6cf6f 100644 --- a/checkpoint_test.go +++ b/checkpoint_test.go @@ -10,6 +10,9 @@ func TestCheckpointRestore(t *testing.T) { if testing.Short() { t.Skip() } + if !supportsCriu { + t.Skip("system does not have criu installed") + } client, err := New(address) if err != nil { t.Fatal(err) @@ -100,6 +103,9 @@ func TestCheckpointRestoreNewContainer(t *testing.T) { if testing.Short() { t.Skip() } + if !supportsCriu { + t.Skip("system does not have criu installed") + } client, err := New(address) if err != nil { t.Fatal(err) diff --git a/client_test.go b/client_test.go index 5bb0e5b01..d9cdc1142 100644 --- a/client_test.go +++ b/client_test.go @@ -19,8 +19,9 @@ const ( ) var ( - address string - noDaemon bool + address string + noDaemon bool + supportsCriu bool ) func init() { @@ -33,6 +34,11 @@ func TestMain(m *testing.M) { if testing.Short() { os.Exit(m.Run()) } + + // check if criu is installed on the system + _, err := exec.LookPath("criu") + supportsCriu = err == nil + var ( cmd *exec.Cmd buf = bytes.NewBuffer(nil)