Merge pull request #964 from crosbymichael/criu-test

Only run checkpoint test if criu is installed
This commit is contained in:
Derek McGowan 2017-06-06 14:33:39 -07:00 committed by GitHub
commit ecc08d7524
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

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