Dump core at beginning and end of node resizes.

pull/6/head
Joe Finney 2016-01-25 09:52:57 -08:00
parent 6397b781ac
commit 7164e88a3a
3 changed files with 11 additions and 7 deletions

View File

@ -48,8 +48,6 @@ const (
var ( var (
cloudConfig = &testContext.CloudConfig cloudConfig = &testContext.CloudConfig
reportDir = flag.String("report-dir", "", "Path to the directory where the JUnit XML reports should be saved. Default is empty, which doesn't generate these reports.")
) )
func init() { func init() {
@ -70,6 +68,7 @@ func init() {
flag.StringVar(&testContext.Provider, "provider", "", "The name of the Kubernetes provider (gce, gke, local, vagrant, etc.)") flag.StringVar(&testContext.Provider, "provider", "", "The name of the Kubernetes provider (gce, gke, local, vagrant, etc.)")
flag.StringVar(&testContext.KubectlPath, "kubectl-path", "kubectl", "The kubectl binary to use. For development, you might use 'cluster/kubectl.sh' here.") flag.StringVar(&testContext.KubectlPath, "kubectl-path", "kubectl", "The kubectl binary to use. For development, you might use 'cluster/kubectl.sh' here.")
flag.StringVar(&testContext.OutputDir, "e2e-output-dir", "/tmp", "Output directory for interesting/useful test data, like performance data, benchmarks, and other metrics.") flag.StringVar(&testContext.OutputDir, "e2e-output-dir", "/tmp", "Output directory for interesting/useful test data, like performance data, benchmarks, and other metrics.")
flag.StringVar(&testContext.ReportDir, "report-dir", "", "Path to the directory where the JUnit XML reports should be saved. Default is empty, which doesn't generate these reports.")
flag.StringVar(&testContext.prefix, "prefix", "e2e", "A prefix to be added to cloud resources created during testing.") flag.StringVar(&testContext.prefix, "prefix", "e2e", "A prefix to be added to cloud resources created during testing.")
// TODO: Flags per provider? Rename gce-project/gce-zone? // TODO: Flags per provider? Rename gce-project/gce-zone?
@ -98,11 +97,11 @@ func TestE2E(t *testing.T) {
util.ReallyCrash = true util.ReallyCrash = true
util.InitLogs() util.InitLogs()
defer util.FlushLogs() defer util.FlushLogs()
if *reportDir != "" { if testContext.ReportDir != "" {
if err := os.MkdirAll(*reportDir, 0755); err != nil { if err := os.MkdirAll(testContext.ReportDir, 0755); err != nil {
glog.Errorf("Failed creating report directory: %v", err) glog.Errorf("Failed creating report directory: %v", err)
} }
defer CoreDump(*reportDir) defer CoreDump(testContext.ReportDir)
} }
if testContext.Provider == "" { if testContext.Provider == "" {
@ -186,8 +185,8 @@ func TestE2E(t *testing.T) {
} }
// Run tests through the Ginkgo runner with output to console + JUnit for Jenkins // Run tests through the Ginkgo runner with output to console + JUnit for Jenkins
var r []ginkgo.Reporter var r []ginkgo.Reporter
if *reportDir != "" { if testContext.ReportDir != "" {
r = append(r, reporters.NewJUnitReporter(path.Join(*reportDir, fmt.Sprintf("junit_%02d.xml", config.GinkgoConfig.ParallelNode)))) r = append(r, reporters.NewJUnitReporter(path.Join(testContext.ReportDir, fmt.Sprintf("junit_%02d.xml", config.GinkgoConfig.ParallelNode))))
} }
glog.Infof("Starting e2e run; %q", runId) glog.Infof("Starting e2e run; %q", runId)
ginkgo.RunSpecsWithDefaultAndCustomReporters(t, "Kubernetes e2e suite", r) ginkgo.RunSpecsWithDefaultAndCustomReporters(t, "Kubernetes e2e suite", r)

View File

@ -44,6 +44,10 @@ const (
) )
func resizeGroup(size int) error { func resizeGroup(size int) error {
if testContext.ReportDir != "" {
CoreDump(testContext.ReportDir)
defer CoreDump(testContext.ReportDir)
}
if testContext.Provider == "gce" || testContext.Provider == "gke" { if testContext.Provider == "gce" || testContext.Provider == "gke" {
// TODO: make this hit the compute API directly instead of shelling out to gcloud. // TODO: make this hit the compute API directly instead of shelling out to gcloud.
// TODO: make gce/gke implement InstanceGroups, so we can eliminate the per-provider logic // TODO: make gce/gke implement InstanceGroups, so we can eliminate the per-provider logic

View File

@ -142,6 +142,7 @@ type TestContextType struct {
CloudConfig CloudConfig CloudConfig CloudConfig
KubectlPath string KubectlPath string
OutputDir string OutputDir string
ReportDir string
prefix string prefix string
MinStartupPods int MinStartupPods int
UpgradeTarget string UpgradeTarget string