diff options
author | Valery Piashchynski <[email protected]> | 2021-02-04 20:37:48 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-02-04 20:37:48 +0300 |
commit | d629f08408a4478aaba90079a4e37ab69cfc12ef (patch) | |
tree | 2cb67bc5c9be295428239369e9d211f3888308fe /pkg/worker/state_test.go | |
parent | efacb852e279e6bbfc076c0faff391ff39815718 (diff) |
pre-rc stabilization of the interfaces and internal code
Diffstat (limited to 'pkg/worker/state_test.go')
-rwxr-xr-x | pkg/worker/state_test.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/pkg/worker/state_test.go b/pkg/worker/state_test.go new file mode 100755 index 00000000..c67182d6 --- /dev/null +++ b/pkg/worker/state_test.go @@ -0,0 +1,27 @@ +package worker + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func Test_NewState(t *testing.T) { + st := NewWorkerState(StateErrored) + + assert.Equal(t, "errored", st.String()) + + assert.Equal(t, "inactive", NewWorkerState(StateInactive).String()) + assert.Equal(t, "ready", NewWorkerState(StateReady).String()) + assert.Equal(t, "working", NewWorkerState(StateWorking).String()) + assert.Equal(t, "stopped", NewWorkerState(StateStopped).String()) + assert.Equal(t, "undefined", NewWorkerState(1000).String()) +} + +func Test_IsActive(t *testing.T) { + assert.False(t, NewWorkerState(StateInactive).IsActive()) + assert.True(t, NewWorkerState(StateReady).IsActive()) + assert.True(t, NewWorkerState(StateWorking).IsActive()) + assert.False(t, NewWorkerState(StateStopped).IsActive()) + assert.False(t, NewWorkerState(StateErrored).IsActive()) +} |