mirror of https://github.com/k3s-io/k3s
Convert SIGTERM into SIGINT in e2e test runner.
parent
4a3b1a2b9d
commit
8c7d6806d4
|
@ -18,9 +18,12 @@ package e2e
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/signal"
|
||||
"path"
|
||||
"regexp"
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
||||
"github.com/golang/glog"
|
||||
|
@ -51,6 +54,23 @@ func init() {
|
|||
|
||||
func (t *testResult) Fail() { *t = false }
|
||||
|
||||
// Convert any received TERM signals into INT signals.
|
||||
// The Ginkgo runner only handles SIGINT, so if Jenkins aborts a run,
|
||||
// we lose all reporting unless we also handle SIGTERM.
|
||||
// This function never returns.
|
||||
func convertSigTermIntoInterrupt() {
|
||||
p, err := os.FindProcess(os.Getpid())
|
||||
if err != nil {
|
||||
glog.Fatalf("Failed looking up own process: %s", err.Error())
|
||||
}
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, syscall.SIGTERM)
|
||||
for {
|
||||
<-c
|
||||
p.Signal(os.Interrupt)
|
||||
}
|
||||
}
|
||||
|
||||
// Run each Go end-to-end-test. This function assumes the
|
||||
// creation of a test cluster.
|
||||
func RunE2ETests(context *TestContextType, orderseed int64, times int, reportDir string, testList []string) {
|
||||
|
@ -58,6 +78,7 @@ func RunE2ETests(context *TestContextType, orderseed int64, times int, reportDir
|
|||
util.ReallyCrash = true
|
||||
util.InitLogs()
|
||||
defer util.FlushLogs()
|
||||
go convertSigTermIntoInterrupt()
|
||||
|
||||
if len(testList) != 0 {
|
||||
if config.GinkgoConfig.FocusString != "" || config.GinkgoConfig.SkipString != "" {
|
||||
|
@ -76,7 +97,6 @@ func RunE2ETests(context *TestContextType, orderseed int64, times int, reportDir
|
|||
}
|
||||
|
||||
// TODO: Make orderseed work again.
|
||||
|
||||
var passed testResult = true
|
||||
gomega.RegisterFailHandler(ginkgo.Fail)
|
||||
// Run the existing tests with output to console + JUnit for Jenkins
|
||||
|
|
Loading…
Reference in New Issue