This commit is contained in:
Ingo Oppermann
2023-05-01 16:39:47 +02:00
parent ef138fb90f
commit c23722416b

View File

@@ -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)