add testcase IsValidStateString

Signed-off-by: chchliang <chen.chuanliang@zte.com.cn>
Upstream-commit: 675ac37482432e13d1312647762d9db8b9bb175e
Component: engine
This commit is contained in:
chchliang
2017-10-24 09:49:58 +08:00
parent a8090896a0
commit 44eef72d75

View File

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