diff --git a/process/process_test.go b/process/process_test.go index 449c9693..13db51a3 100644 --- a/process/process_test.go +++ b/process/process_test.go @@ -51,7 +51,7 @@ func TestReconnectProcess(t *testing.T) { "2", }, Reconnect: true, - ReconnectDelay: 10 * time.Second, + ReconnectDelay: 3 * time.Second, StaleTimeout: 0, OnExit: func(string) { wg.Done() @@ -72,6 +72,22 @@ func TestReconnectProcess(t *testing.T) { require.Greater(t, p.Status().Reconnect, time.Duration(0)) + wg.Add(1) + + p.Start() + + require.Eventually(t, func() bool { + return p.Status().State == "running" + }, 10*time.Second, 500*time.Millisecond) + + require.Eventually(t, func() bool { + 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) require.Equal(t, "finished", p.Status().State)