Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert SIGTERM into SIGINT in e2e test runner #6388

Merged
1 commit merged into from
Apr 3, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion test/e2e/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -51,13 +54,31 @@ 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) {
testContext = *context
util.ReallyCrash = true
util.InitLogs()
defer util.FlushLogs()
go convertSigTermIntoInterrupt()

if len(testList) != 0 {
if config.GinkgoConfig.FocusString != "" || config.GinkgoConfig.SkipString != "" {
Expand All @@ -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
Expand Down