Skip to content

Commit 722cde0

Browse files
committed
tests: Add timeout to forcibly exit after interupt
When an interupt it sent forcibly exit after 30s in the case that cancelling the context doesn't actually cancel the builds. Signed-off-by: Brian Goff <[email protected]>
1 parent 71cd047 commit 722cde0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test/main_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"fmt"
77
"os"
88
"os/signal"
9+
"syscall"
910
"testing"
1011
"time"
1112

@@ -72,6 +73,10 @@ func TestMain(m *testing.M) {
7273
// Cancel our signal handler so the normal handler takes over from here.
7374
// This allows subsequent interupts to use the default behavior (exit the program)
7475
done()
76+
77+
<-time.After(30 * time.Second)
78+
fmt.Fprintln(os.Stderr, "Timeout waiting for builds to cancel after interupt")
79+
os.Exit(int(syscall.SIGINT))
7580
}()
7681

7782
defer func() {

0 commit comments

Comments
 (0)