Only run checkpoint test if criu is installed

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2017-06-06 14:18:59 -07:00
parent 25cc7614ae
commit 304fc470f4
2 changed files with 14 additions and 2 deletions

View File

@ -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)

View File

@ -21,6 +21,7 @@ const (
var (
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)