當前位置: 首頁>>代碼示例>>Golang>>正文


Golang MinikubeRunner.RunCommand方法代碼示例

本文整理匯總了Golang中github.com/jimmidyson/minishift/test/integration/util.MinikubeRunner.RunCommand方法的典型用法代碼示例。如果您正苦於以下問題:Golang MinikubeRunner.RunCommand方法的具體用法?Golang MinikubeRunner.RunCommand怎麽用?Golang MinikubeRunner.RunCommand使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/jimmidyson/minishift/test/integration/util.MinikubeRunner的用法示例。


在下文中一共展示了MinikubeRunner.RunCommand方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: TestClusterSSH

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)
	}
}
開發者ID:rawlingsj,項目名稱:gofabric8,代碼行數:13,代碼來源:cluster_ssh_test.go

示例2: TestStartStop

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")
}
開發者ID:rawlingsj,項目名稱:gofabric8,代碼行數:27,代碼來源:start_stop_delete_test.go

示例3: TestClusterLogs

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)
		}
	}
}
開發者ID:rawlingsj,項目名稱:gofabric8,代碼行數:16,代碼來源:cluster_logs_test.go

示例4: TestClusterEnv

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)
	}
}
開發者ID:rawlingsj,項目名稱:gofabric8,代碼行數:23,代碼來源:cluster_env_test.go


注:本文中的github.com/jimmidyson/minishift/test/integration/util.MinikubeRunner.RunCommand方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。