mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
add testcase IsValidStateString
Signed-off-by: chchliang <chen.chuanliang@zte.com.cn>
This commit is contained in:
parent
a5f9783c93
commit
675ac37482
1 changed files with 24 additions and 0 deletions
|
@ -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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue