Skip to content

Commit 967e6bb

Browse files
author
Phillip Wittrock
committed
Merge pull request kubernetes#1107 from pwittrock/fix-integration-test
fix integration tests always passing because of obscure golang variab…
2 parents 8fbb008 + cf8f46f commit 967e6bb

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

integration/runner/runner.go

+7-6
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,15 @@ func PushAndRunTests(host, testDir string) error {
172172
if err != nil {
173173
// Copy logs from the host
174174
args = common.GetGCComputeArgs("copy-files", fmt.Sprintf("%s:%s/log.txt", host, testDir), "./")
175-
err = RunCommand("gcloud", args...)
176-
if err != nil {
177-
return fmt.Errorf("error fetching logs: %v", err)
175+
// Declare new error or it will get shadowed by logs, err := <> and we won't be able to unset it from nil
176+
err2 := RunCommand("gcloud", args...)
177+
if err2 != nil {
178+
return fmt.Errorf("error fetching logs: %v for %v", err2, err)
178179
}
179180
defer os.Remove("./log.txt")
180-
logs, err := ioutil.ReadFile("./log.txt")
181-
if err != nil {
182-
return fmt.Errorf("error reading local log file: %v", err)
181+
logs, err2 := ioutil.ReadFile("./log.txt")
182+
if err2 != nil {
183+
return fmt.Errorf("error reading local log file: %v for %v", err2, err)
183184
}
184185
glog.Errorf("----------------------\nLogs from Host: %q\n%v\n", host, string(logs))
185186
err = fmt.Errorf("error on host %s: %v\n%+v", host, err, attributes)

0 commit comments

Comments
 (0)