diff --git a/main_test.go b/main_test.go index 414a56074ca2b7b59b03d6baa42d591e408804ac..bcbedf1e896234b6f8ebc5b7d3f6710e2447c40e 100644 --- a/main_test.go +++ b/main_test.go @@ -204,8 +204,8 @@ func TestBadExec(t *testing.T) { if e, ok := err.(*exec.ExitError); ok { if status, ok := e.Sys().(syscall.WaitStatus); ok { - if status.ExitStatus() != 2 { - log.Fatal("Expect 2 exit code got ", status.ExitStatus()) + if status.ExitStatus() != 125 { + log.Fatal("Expect 125 exit code got ", status.ExitStatus()) } } } else { @@ -215,7 +215,7 @@ func TestBadExec(t *testing.T) { func TestGoodExec(t *testing.T) { c := &Context{ - Args: []string{"-d", "busybox", "echo", "hi"}, + Args: []string{"-d", "busybox", "sleep", "1"}, } err := runContainer(c) @@ -243,7 +243,7 @@ func TestParseCgroups(t *testing.T) { if val, ok := cgroups["blkio"]; ok { p := path.Join(SYSFS, "blkio", val) if _, err := os.Stat(p); os.IsNotExist(err) { - log.Fatalf("Path does not exist %s", p, err) + log.Fatalf("Path does not exist %s", err) } } else { log.Fatal("Failed to find blkio cgroup", val) @@ -252,7 +252,7 @@ func TestParseCgroups(t *testing.T) { func TestMoveCgroup(t *testing.T) { c := &Context{ - Args: []string{"-d", "busybox", "echo", "hi"}, + Args: []string{"-d", "busybox", "sleep", "1"}, } err := runContainer(c) @@ -277,7 +277,7 @@ func TestMoveCgroup(t *testing.T) { } func TestRemoveNoLogs(t *testing.T) { - c, err := mainWithArgs([]string{"--logs=false", "run", "-rm", "busybox", "echo", "hi"}) + c, err := mainWithArgs([]string{"--logs=false", "run", "-rm", "busybox", "sleep", "1"}) if err != nil { t.Fatal(err) } @@ -294,7 +294,7 @@ func TestRemoveNoLogs(t *testing.T) { } func TestRemoveWithLogs(t *testing.T) { - c, err := mainWithArgs([]string{"--logs", "run", "-rm", "busybox", "echo", "hi"}) + c, err := mainWithArgs([]string{"--logs", "run", "-rm", "busybox", "sleep", "1"}) if err != nil { t.Fatal(err) } @@ -338,7 +338,7 @@ func TestNamedContainerNoRm(t *testing.T) { deleteTestContainer(t) - c, err := mainWithArgs([]string{"--logs", "run", "--privileged=true", "--name", "systemd-docker-test", "--privileged=true", "busybox", "echo", "hi"}) + _, err = mainWithArgs([]string{"--logs", "run", "--privileged=true", "--name", "systemd-docker-test", "--privileged=true", "busybox", "sleep", "1"}) if err != nil { t.Fatal(err) } @@ -352,7 +352,7 @@ func TestNamedContainerNoRm(t *testing.T) { t.Fatal("Should not be running") } - c, err = mainWithArgs([]string{"--logs", "run", "--privileged=true", "--name", "systemd-docker-test", "busybox", "echo", "hi"}) + c, err := mainWithArgs([]string{"--logs", "run", "--privileged=true", "--name", "systemd-docker-test", "busybox", "sleep", "1"}) if err != nil { t.Fatal(err) } @@ -370,9 +370,9 @@ func TestNamedContainerNoRm(t *testing.T) { t.Fatal("Should be the same container", container.ID, container2.ID) } - if !container2.HostConfig.Privileged { - t.Fatal("Container2 is not privileged") - } + if !container2.HostConfig.Privileged { + t.Fatal("Container2 is not privileged") + } deleteTestContainer(t) } @@ -385,7 +385,7 @@ func TestNamedContainerRmPrevious(t *testing.T) { deleteTestContainer(t) - c, err := mainWithArgs([]string{"--logs", "run", "--name", "systemd-docker-test", "busybox", "echo", "hi"}) + c, err := mainWithArgs([]string{"--logs", "run", "--name", "systemd-docker-test", "busybox", "sleep", "1"}) if err != nil { t.Fatal(err) } @@ -399,7 +399,7 @@ func TestNamedContainerRmPrevious(t *testing.T) { t.Fatal("Should not be running") } - c, err = mainWithArgs([]string{"--logs", "run", "--rm", "--name", "systemd-docker-test", "busybox", "echo", "hi"}) + c, err = mainWithArgs([]string{"--logs", "run", "--rm", "--name", "systemd-docker-test", "busybox", "sleep", "1"}) if err != nil { t.Fatal(err) } @@ -438,7 +438,7 @@ func TestNamedContainerAttach(t *testing.T) { t.Fatal("Should be running") } - c, err = mainWithArgs([]string{"--logs=false", "run", "--name", "systemd-docker-test", "busybox", "echo", "hi"}) + c, err = mainWithArgs([]string{"--logs=false", "run", "--name", "systemd-docker-test", "busybox", "sleep", "1"}) if err != nil { t.Fatal(err) } @@ -474,7 +474,7 @@ func TestPidFile(t *testing.T) { os.Remove(pidFileName) - c, err := mainWithArgs([]string{"--logs=false", "--pid-file", "./pid-file", "run", "--rm", "busybox", "echo", "hi"}) + c, err := mainWithArgs([]string{"--logs=false", "--pid-file", "./pid-file", "run", "--rm", "busybox", "sleep", "1"}) if err != nil { t.Fatal(err) }