mirror of
https://github.com/docker/cli.git
synced 2026-01-13 18:22:35 +03:00
Merge pull request #35273 from chchliang/containerstate
add testcase IsValidStateString Upstream-commit: 05026b187b35dfa97e5f4895c6c0a21feb8bc90d Component: engine
This commit is contained in:
@@ -166,3 +166,27 @@ func TestStateTimeoutWait(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsValidStateString(t *testing.T) {
|
||||
states := []struct {
|
||||
state string
|
||||
expected bool
|
||||
}{
|
||||
{"paused", true},
|
||||
{"restarting", true},
|
||||
{"running", true},
|
||||
{"dead", true},
|
||||
{"start", false},
|
||||
{"created", true},
|
||||
{"exited", true},
|
||||
{"removing", true},
|
||||
{"stop", false},
|
||||
}
|
||||
|
||||
for _, s := range states {
|
||||
v := IsValidStateString(s.state)
|
||||
if v != s.expected {
|
||||
t.Fatalf("Expected %t, but got %t", s.expected, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user