Fix tests
This commit is contained in:
parent
f0a7564c55
commit
b7e0afc7a7
@ -54,6 +54,10 @@ func TestReconnectProcess(t *testing.T) {
|
||||
|
||||
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)
|
||||
@ -565,6 +569,9 @@ func TestProcessCallbacks(t *testing.T) {
|
||||
onState := []string{}
|
||||
|
||||
lock := sync.Mutex{}
|
||||
wg := sync.WaitGroup{}
|
||||
|
||||
wg.Add(1)
|
||||
|
||||
p, err := New(Config{
|
||||
Binary: "sleep",
|
||||
@ -599,6 +606,8 @@ func TestProcessCallbacks(t *testing.T) {
|
||||
defer lock.Unlock()
|
||||
|
||||
onExit = state
|
||||
|
||||
wg.Done()
|
||||
},
|
||||
OnStateChange: func(from, to string) {
|
||||
lock.Lock()
|
||||
@ -620,6 +629,8 @@ func TestProcessCallbacks(t *testing.T) {
|
||||
return p.Status().State == "finished"
|
||||
}, 10*time.Second, 500*time.Millisecond)
|
||||
|
||||
wg.Wait()
|
||||
|
||||
lock.Lock()
|
||||
require.ElementsMatch(t, []string{"2"}, args)
|
||||
require.True(t, onBeforeStart)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user