Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Commit

Permalink
Make less flakey
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel committed May 24, 2016
1 parent 19e1786 commit acac3e0
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions process/process_nix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,20 @@ func TestFindProcessWait(t *testing.T) {
procPath := procPath(t)
cmd := exec.Command(procPath, "10")
defer cleanupProc(cmd, procPath)
go func() {
time.Sleep(10 * time.Millisecond)
err := cmd.Start()
require.NoError(t, err)
}()

// Ensure it's not already running
procs, err := FindProcesses(NewMatcher(procPath, PathEqual, testLog), time.Millisecond, 0, testLog)
require.NoError(t, err)
require.Equal(t, 0, len(procs))

go func() {
time.Sleep(10 * time.Millisecond)
startErr := cmd.Start()
require.NoError(t, startErr)
}()

// Wait up to second for process to be running
procs, err = FindProcesses(NewMatcher(procPath, PathEqual, testLog), time.Second, 0, testLog)
procs, err = FindProcesses(NewMatcher(procPath, PathEqual, testLog), time.Second, 10*time.Millisecond, testLog)
require.NoError(t, err)
require.True(t, len(procs) == 1)
}
Expand Down

0 comments on commit acac3e0

Please sign in to comment.