-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathhelpers.go
36 lines (29 loc) · 860 Bytes
/
helpers.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package ginkgomon
import (
"fmt"
"os"
"github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/tedsuo/ifrit"
)
func Invoke(runner ifrit.Runner) ifrit.Process {
process := ifrit.Background(runner)
select {
case <-process.Ready():
case err := <-process.Wait():
ginkgo.Fail(fmt.Sprintf("process failed to start: %s", err), 1)
}
return process
}
func Interrupt(process ifrit.Process, intervals ...interface{}) {
if process != nil {
process.Signal(os.Interrupt)
EventuallyWithOffset(1, process.Wait(), intervals...).Should(Receive(), "interrupted ginkgomon process failed to exit in time")
}
}
func Kill(process ifrit.Process, intervals ...interface{}) {
if process != nil {
process.Signal(os.Kill)
EventuallyWithOffset(1, process.Wait(), intervals...).Should(Receive(), "killed ginkgomon process failed to exit in time")
}
}