From 44ef1224fe1254009d08a4e1f622256bdfc63eea Mon Sep 17 00:00:00 2001 From: Joe Finney Date: Wed, 2 Mar 2016 15:59:43 -0800 Subject: [PATCH] Move CoreDump into test/e2e/util.go, add docstring. --- test/e2e/core.go | 33 --------------------------------- test/e2e/util.go | 12 ++++++++++++ 2 files changed, 12 insertions(+), 33 deletions(-) delete mode 100644 test/e2e/core.go diff --git a/test/e2e/core.go b/test/e2e/core.go deleted file mode 100644 index ccd8fdab828..00000000000 --- a/test/e2e/core.go +++ /dev/null @@ -1,33 +0,0 @@ -/* -Copyright 2015 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package e2e - -import ( - "log" - "os" - "os/exec" - "path" -) - -func CoreDump(dir string) { - cmd := exec.Command(path.Join(testContext.RepoRoot, "cluster", "log-dump.sh"), dir) - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - if err := cmd.Run(); err != nil { - log.Printf("Error running cluster/log-dump.sh: %v", err) - } -} diff --git a/test/e2e/util.go b/test/e2e/util.go index 02f42581488..85311510bd5 100644 --- a/test/e2e/util.go +++ b/test/e2e/util.go @@ -29,6 +29,7 @@ import ( "net/url" "os" "os/exec" + "path" "path/filepath" "sort" "strconv" @@ -3543,3 +3544,14 @@ func CheckConnectivityToHost(f *Framework, nodeName, podName, host string) error defer podClient.Delete(podName, nil) return waitForPodSuccessInNamespace(f.Client, podName, contName, f.Namespace.Name) } + +// CoreDump SSHs to the master and all nodes and dumps their logs into dir. +// It shells out to cluster/log-dump.sh to accomplish this. +func CoreDump(dir string) { + cmd := exec.Command(path.Join(testContext.RepoRoot, "cluster", "log-dump.sh"), dir) + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + if err := cmd.Run(); err != nil { + Logf("Error running cluster/log-dump.sh: %v", err) + } +}