Move CoreDump into test/e2e/util.go, add docstring.

This commit is contained in:
Joe Finney 2016-03-02 15:59:43 -08:00
parent 8d1d368401
commit 44ef1224fe
2 changed files with 12 additions and 33 deletions

View File

@ -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)
}
}

View File

@ -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)
}
}