diff --git a/process/process_test.go b/process/process_test.go index 722324a3..449c9693 100644 --- a/process/process_test.go +++ b/process/process_test.go @@ -42,14 +42,20 @@ func TestProcess(t *testing.T) { } func TestReconnectProcess(t *testing.T) { + wg := sync.WaitGroup{} + wg.Add(1) + p, _ := New(Config{ Binary: "sleep", Args: []string{ "2", }, Reconnect: true, - ReconnectDelay: 2 * time.Second, + ReconnectDelay: 10 * time.Second, StaleTimeout: 0, + OnExit: func(string) { + wg.Done() + }, }) p.Start() @@ -62,6 +68,8 @@ func TestReconnectProcess(t *testing.T) { return p.Status().State == "finished" }, 10*time.Second, 500*time.Millisecond) + wg.Wait() + require.Greater(t, p.Status().Reconnect, time.Duration(0)) p.Stop(false)