}
wg.Wait()
<-ctx.Done()
- fmt.Print("received SIGINT")
+ fmt.Println("received SIGINT")
// Sleep to give time to simultaneous signals to reach the process.
// These signals must be ignored given stop() is not called on this code.
// We want to guarantee a SIGINT doesn't cause a premature termination of the program.
{"multiple", 10},
}
for _, tc := range testCases {
+ tc := tc
t.Run(tc.name, func(t *testing.T) {
+ t.Parallel()
+
var subTimeout time.Duration
if deadline, ok := t.Deadline(); ok {
- subTimeout := time.Until(deadline)
- subTimeout -= subTimeout / 10 // Leave 10% headroom for cleaning up subprocess.
+ timeout := time.Until(deadline)
+ if timeout < 2*settleTime {
+ t.Fatalf("starting test with less than %v remaining", 2*settleTime)
+ }
+ subTimeout = timeout - (timeout / 10) // Leave 10% headroom for cleaning up subprocess.
}
args := []string{
if err != nil {
t.Errorf("ran test with -check_notify_ctx_notification and it failed with %v.\nOutput:\n%s", err, out)
}
- if want := []byte("received SIGINT"); !bytes.Contains(out, want) {
+ if want := []byte("received SIGINT\n"); !bytes.Contains(out, want) {
t.Errorf("got %q, wanted %q", out, want)
}
})