mirror of
https://github.com/datarhei/core.git
synced 2025-10-06 00:17:07 +08:00
Fix test
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user