mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-06 05:31:47 +00:00
Test for restarting count
This test is for #10058 Signed-off-by: Alexander Morozov <lk4d4@docker.com>
This commit is contained in:
committed by
Alexandr Morozov
parent
5862422a49
commit
79d30364c9
@@ -2935,3 +2935,23 @@ func TestRunOOMExitCode(t *testing.T) {
|
||||
|
||||
logDone("run - exit code on oom")
|
||||
}
|
||||
|
||||
func TestRunRestartMaxRetries(t *testing.T) {
|
||||
defer deleteAllContainers()
|
||||
out, err := exec.Command(dockerBinary, "run", "-d", "--restart=on-failure:3", "busybox", "false").CombinedOutput()
|
||||
if err != nil {
|
||||
t.Fatal(string(out), err)
|
||||
}
|
||||
id := strings.TrimSpace(string(out))
|
||||
if err := waitInspect(id, "{{ .State.Restarting }} {{ .State.Running }}", "false false", 5); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
count, err := inspectField(id, "RestartCount")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if count != "3" {
|
||||
t.Fatalf("Container was restarted %s times, expected %d", count, 3)
|
||||
}
|
||||
logDone("run - test max-retries for --restart")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user