| 12 | ) |
| 13 | |
| 14 | func TestState_String(t *testing.T) { |
| 15 | t.Parallel() |
| 16 | |
| 17 | cases := []struct { |
| 18 | state lifecycle.State |
| 19 | want string |
| 20 | }{ |
| 21 | {lifecycle.StateStopped, "stopped"}, |
| 22 | {lifecycle.StateStarting, "starting"}, |
| 23 | {lifecycle.StateReady, "ready"}, |
| 24 | {lifecycle.StateDegraded, "degraded"}, |
| 25 | {lifecycle.StateRestarting, "restarting"}, |
| 26 | {lifecycle.StateFailed, "failed"}, |
| 27 | {lifecycle.State(99), "state(99)"}, |
| 28 | {lifecycle.State(-1), "state(-1)"}, // must not panic on negative |
| 29 | } |
| 30 | for _, tc := range cases { |
| 31 | assert.Check(t, is.Equal(tc.state.String(), tc.want)) |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | func TestState_IsTerminal(t *testing.T) { |
| 36 | t.Parallel() |