From 8b98d08b5f72618c4e8b417887d47a79dda3d34b Mon Sep 17 00:00:00 2001 From: Xuewei Zhang Date: Wed, 20 Nov 2019 17:13:54 -0800 Subject: [PATCH] Record scp command failure message to help debugging --- test/e2e/lib/gce/instance.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/e2e/lib/gce/instance.go b/test/e2e/lib/gce/instance.go index b8c0f9fc..19ed8757 100644 --- a/test/e2e/lib/gce/instance.go +++ b/test/e2e/lib/gce/instance.go @@ -159,9 +159,13 @@ func (ins *Instance) PushFile(srcPath, destPath string) error { if ins.ExternalIP == "" { ins.populateExternalIP() } - return exec.Command("scp", "-o", "StrictHostKeyChecking no", + output, err := exec.Command("scp", "-o", "StrictHostKeyChecking no", "-i", ins.SshKey, - srcPath, fmt.Sprintf("%s@%s:%s", ins.SshUser, ins.ExternalIP, destPath)).Run() + srcPath, fmt.Sprintf("%s@%s:%s", ins.SshUser, ins.ExternalIP, destPath)).CombinedOutput() + if err != nil { + return fmt.Errorf("Error running scp: %v.\nHere is the output for the command: %v", err, string(output)) + } + return nil } // DeleteInstance deletes a GCE instance.