From 8923e4b5cda71122e31bcb45ba4c19ef81864289 Mon Sep 17 00:00:00 2001 From: Medya Gh Date: Tue, 20 Aug 2019 18:04:56 -0700 Subject: [PATCH] Fix string replace --- test/integration/util/minikube_runner.go | 10 +++++----- test/integration/version_upgrade_test.go | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/integration/util/minikube_runner.go b/test/integration/util/minikube_runner.go index 7dc09b02c9..105f7f5887 100644 --- a/test/integration/util/minikube_runner.go +++ b/test/integration/util/minikube_runner.go @@ -100,7 +100,7 @@ func (m *MinikubeRunner) teeRun(cmd *exec.Cmd, waitForRun ...bool) (string, stri // RunCommand executes a command, optionally checking for error and by default waits for run to finish func (m *MinikubeRunner) RunCommand(cmdStr string, failError bool, waitForRun ...bool) (string, string) { - profileArg := fmt.Sprintf(" -p=%s ", m.Profile) + profileArg := fmt.Sprintf("-p=%s ", m.Profile) cmdStr = profileArg + cmdStr cmdArgs := strings.Split(cmdStr, " ") path, _ := filepath.Abs(m.BinaryPath) @@ -111,9 +111,9 @@ func (m *MinikubeRunner) RunCommand(cmdStr string, failError bool, waitForRun .. if err != nil { errMsg := "" if exitError, ok := err.(*exec.ExitError); ok { - errMsg = fmt.Sprintf("Error running command: %s %s. Output: %s Stderr: %s", cmdStr, exitError.Stderr, stdout, stderr) + errMsg = fmt.Sprintf("Error RunCommand: %q : %q. Output: %q Stderr: %q", cmdStr, exitError.Stderr, stdout, stderr) } else { - errMsg = fmt.Sprintf("Error running command: %s %s. Output: %s", cmdStr, stderr, stdout) + errMsg = fmt.Sprintf("Error RunCommand: %q : %q. Output: %q", cmdStr, stderr, stdout) } if failError { m.T.Fatalf(errMsg) @@ -127,7 +127,7 @@ func (m *MinikubeRunner) RunCommand(cmdStr string, failError bool, waitForRun .. // RunCommandRetriable executes a command, returns error // the purpose of this command is to make it retriable by returning error func (m *MinikubeRunner) RunCommandRetriable(cmdStr string, waitForRun ...bool) (stdout string, stderr string, err error) { - profileArg := fmt.Sprintf(" -p=%s ", m.Profile) + profileArg := fmt.Sprintf("-p=%s ", m.Profile) cmdStr = profileArg + cmdStr cmdArgs := strings.Split(cmdStr, " ") path, _ := filepath.Abs(m.BinaryPath) @@ -147,7 +147,7 @@ func (m *MinikubeRunner) RunCommandRetriable(cmdStr string, waitForRun ...bool) // RunWithContext calls the minikube command with a context, useful for timeouts. func (m *MinikubeRunner) RunWithContext(ctx context.Context, cmdStr string, wait ...bool) (string, string, error) { - profileArg := fmt.Sprintf(" -p=%s ", m.Profile) + profileArg := fmt.Sprintf("-p=%s ", m.Profile) cmdStr = profileArg + cmdStr cmdArgs := strings.Split(cmdStr, " ") path, _ := filepath.Abs(m.BinaryPath) diff --git a/test/integration/version_upgrade_test.go b/test/integration/version_upgrade_test.go index 86cabba679..a9c0da2453 100644 --- a/test/integration/version_upgrade_test.go +++ b/test/integration/version_upgrade_test.go @@ -85,7 +85,7 @@ func TestVersionUpgrade(t *testing.T) { // For full coverage: also test upgrading from oldest to newest supported k8s release stdout, stderr, err := mkRelease.Start(fmt.Sprintf("--kubernetes-version=%s", constants.OldestKubernetesVersion)) if err != nil { - t.Fatalf("TestVersionUpgrade minikube start failed : %v\nstdout: %s\nstderr: %s", err, stdout, stderr) + t.Fatalf("minikube start (%s) failed : %v\nstdout: %s\nstderr: %s", t.Name(), err, stdout, stderr) } mkRelease.CheckStatus(state.Running.String())