Signed-off-by: chchliang <chen.chuanliang@zte.com.cn>
| ... | ... |
@@ -166,3 +166,27 @@ func TestStateTimeoutWait(t *testing.T) {
|
| 166 | 166 |
} |
| 167 | 167 |
} |
| 168 | 168 |
} |
| 169 |
+ |
|
| 170 |
+func TestIsValidStateString(t *testing.T) {
|
|
| 171 |
+ states := []struct {
|
|
| 172 |
+ state string |
|
| 173 |
+ expected bool |
|
| 174 |
+ }{
|
|
| 175 |
+ {"paused", true},
|
|
| 176 |
+ {"restarting", true},
|
|
| 177 |
+ {"running", true},
|
|
| 178 |
+ {"dead", true},
|
|
| 179 |
+ {"start", false},
|
|
| 180 |
+ {"created", true},
|
|
| 181 |
+ {"exited", true},
|
|
| 182 |
+ {"removing", true},
|
|
| 183 |
+ {"stop", false},
|
|
| 184 |
+ } |
|
| 185 |
+ |
|
| 186 |
+ for _, s := range states {
|
|
| 187 |
+ v := IsValidStateString(s.state) |
|
| 188 |
+ if v != s.expected {
|
|
| 189 |
+ t.Fatalf("Expected %t, but got %t", s.expected, v)
|
|
| 190 |
+ } |
|
| 191 |
+ } |
|
| 192 |
+} |