Skip to content

Commit

Permalink
Add "already restarting" test case
Browse files Browse the repository at this point in the history
  • Loading branch information
nkryuchkov committed Dec 24, 2019
1 parent a926401 commit b8e2cd0
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions pkg/restart/restart_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,25 @@ func TestContext_Restart(t *testing.T) {

assert.Equal(t, ErrMalformedArgs, cc.Restart())
})

t.Run("already restarting", func(t *testing.T) {
cc.args = nil

cmd := "touch"
path := "/tmp/test_restart"
args := []string{cmd, path}
cc.args = args

ch := make(chan error, 1)
go func() {
ch <- cc.Restart()
}()

assert.NoError(t, cc.Restart())
assert.NoError(t, os.Remove(path))

assert.Equal(t, ErrAlreadyRestarting, <-ch)
})
}

func TestContext_SetCheckDelay(t *testing.T) {
Expand Down

0 comments on commit b8e2cd0

Please sign in to comment.