func TestClusterSSH(t *testing.T) { minikubeRunner := util.MinikubeRunner{ Args: *args, BinaryPath: *binaryPath, T: t} minikubeRunner.EnsureRunning() expectedStr := "hello" sshCmdOutput := minikubeRunner.RunCommand("ssh echo "+expectedStr, true) if !strings.Contains(sshCmdOutput, expectedStr) { t.Fatalf("ExpectedStr sshCmdOutput to be: %s. Output was: %s", expectedStr, sshCmdOutput) } }
func TestStartStop(t *testing.T) { runner := util.MinikubeRunner{ Args: *args, BinaryPath: *binaryPath, T: t} runner.RunCommand("delete", false) runner.CheckStatus("Does Not Exist") runner.Start() runner.CheckStatus("Running") ip := runner.RunCommand("ip", true) ip = strings.TrimRight(ip, "\n") if net.ParseIP(ip) == nil { t.Fatalf("IP command returned an invalid address: %s", ip) } runner.RunCommand("stop", true) runner.CheckStatus("Stopped") runner.Start() runner.CheckStatus("Running") runner.RunCommand("delete", true) runner.CheckStatus("Does Not Exist") }
func TestClusterLogs(t *testing.T) { minikubeRunner := util.MinikubeRunner{ Args: *args, BinaryPath: *binaryPath, T: t} minikubeRunner.EnsureRunning() logsCmdOutput := minikubeRunner.RunCommand("logs", true) //check for # of lines or check for strings logFiles := []string{constants.RemoteOpenShiftErrPath, constants.RemoteOpenShiftOutPath} for _, logFile := range logFiles { if !strings.Contains(logsCmdOutput, logFile) { t.Fatalf("Error in logsCmdOutput, expected to find: %s. Output: %s", logFile, logsCmdOutput) } } }
func TestClusterEnv(t *testing.T) { minikubeRunner := util.MinikubeRunner{ Args: *args, BinaryPath: *binaryPath, T: t} minikubeRunner.EnsureRunning() dockerEnvVars := minikubeRunner.RunCommand("docker-env", true) if err := minikubeRunner.SetEnvFromEnvCmdOutput(dockerEnvVars); err != nil { t.Fatalf("Error: No environment variables were found in docker-env command output: ", dockerEnvVars) } path, err := exec.LookPath("docker") var output []byte dockerPs := func() error { cmd := exec.Command(path, "ps") output, err = cmd.CombinedOutput() return err } if err := commonutil.RetryAfter(5, dockerPs, 3*time.Second); err != nil { t.Fatalf("Error running command: %s. Error: %s Output: %s", "docker ps", err, output) } }