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


Golang vagrantssh.TestbedNode類代碼示例

本文整理匯總了Golang中github.com/contiv/vagrantssh.TestbedNode的典型用法代碼示例。如果您正苦於以下問題:Golang TestbedNode類的具體用法?Golang TestbedNode怎麽用?Golang TestbedNode使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: CheckBgpNoConnectionForaNode

func (s *systemtestSuite) CheckBgpNoConnectionForaNode(c *C, node vagrantssh.TestbedNode) error {
	for i := 0; i < 100; i++ {
		time.Sleep(3 * time.Second)
		out, _ := node.RunCommandWithOutput("/opt/gopath/bin/gobgp neighbor")
		fmt.Println(out)
		if !strings.Contains(out, "Establ") {
			return nil
		}
	}
	return errors.New("BGP connection persists")
}
開發者ID:karamsivia,項目名稱:netplugin,代碼行數:11,代碼來源:bgp_test.go

示例2: waitForStatToFail

func (s *SystemTestSuite) waitForStatToFail(c *C, nut vagrantssh.TestbedNode, file string) {
	out, err := tutils.WaitForDone(func() (string, bool) {
		cmdStr := fmt.Sprintf("stat -t %s", file)
		out, err := nut.RunCommandWithOutput(cmdStr)
		if err == nil {
			return out, false
		}
		return out, true
	}, 1*time.Second, 10*time.Second, fmt.Sprintf("file %q still seems to exist", file))
	s.Assert(c, err, IsNil, Commentf("output: %s", out))
}
開發者ID:contiv,項目名稱:cluster,代碼行數:11,代碼來源:utils.go

示例3: waitForSerfMembership

func (s *SystemTestSuite) waitForSerfMembership(c *C, nut vagrantssh.TestbedNode, nodeName, state string) {
	out, err := tutils.WaitForDone(func() (string, bool) {
		out, err := nut.RunCommandWithOutput(`serf members`)
		if err != nil {
			return out, false
		}
		stateStr := fmt.Sprintf(`%s.*%s.*`, nodeName, state)
		if match, err := regexp.MatchString(stateStr, out); err != nil || !match {
			return out, false
		}
		return out, true
	}, 1*time.Second, time.Duration(10)*time.Second,
		fmt.Sprintf("%s's serf membership is not in %s state", nodeName, state))
	s.Assert(c, err, IsNil, Commentf("output: %s", out))
}
開發者ID:contiv,項目名稱:cluster,代碼行數:15,代碼來源:utils.go

示例4: checkProvisionStatus

func (s *SystemTestSuite) checkProvisionStatus(c *C, tbn1 vagrantssh.TestbedNode, nodeName, exptdStatus string) {
	exptdStr := fmt.Sprintf(`.*"status".*"%s".*`, exptdStatus)
	out, err := tutils.WaitForDone(func() (string, bool) {
		cmdStr := fmt.Sprintf("clusterctl node get %s --json", nodeName)
		out, err := tbn1.RunCommandWithOutput(cmdStr)
		if err != nil {
			return out, false
			//replace newline with empty string for regex to match properly
		} else if match, err := regexp.MatchString(exptdStr,
			strings.Replace(out, "\n", "", -1)); err == nil && match {
			return out, true
		}
		return out, false
	}, 1*time.Second, 30*time.Second, fmt.Sprintf("node is still not in %q status", exptdStatus))
	s.Assert(c, err, IsNil, Commentf("output: %s", out))
}
開發者ID:contiv,項目名稱:cluster,代碼行數:16,代碼來源:utils.go

示例5: ServiceStatus

//ServiceStatus queries and returns status result of systemd service unit
func ServiceStatus(n vagrantssh.TestbedNode, srv string) (string, error) {
	return n.RunCommandWithOutput(fmt.Sprintf("systemctl status %s", srv))
}
開發者ID:vvb,項目名稱:netplugin,代碼行數:4,代碼來源:system.go

示例6: ClearEtcd

func ClearEtcd(node vagrantssh.TestbedNode) {
	log.Infof("Clearing etcd data")
	node.RunCommand(`for i in $(etcdctl ls /); do etcdctl rm --recursive "$i"; done`)
}
開發者ID:vvb,項目名稱:netplugin,代碼行數:4,代碼來源:system.go

示例7: ServiceLogs

//ServiceLogs queries and returns upto maxLogLines lines from systemd service unit logs
func ServiceLogs(n vagrantssh.TestbedNode, srv string, maxLogLines int) (string, error) {
	return n.RunCommandWithOutput(fmt.Sprintf("sudo systemctl status -ln%d %s", maxLogLines, srv))
}
開發者ID:vvb,項目名稱:netplugin,代碼行數:4,代碼來源:system.go

示例8: ServiceRestart

//ServiceRestart restarts a systemd service unit
func ServiceRestart(n vagrantssh.TestbedNode, srv string) (string, error) {
	return n.RunCommandWithOutput(fmt.Sprintf("sudo systemctl restart %s", srv))
}
開發者ID:vvb,項目名稱:netplugin,代碼行數:4,代碼來源:system.go

示例9: touchFileAndWaitForStatToSucceed

func (s *SystemTestSuite) touchFileAndWaitForStatToSucceed(c *C, nut vagrantssh.TestbedNode, file string) {
	cmdStr := fmt.Sprintf("touch %s", file)
	out, err := nut.RunCommandWithOutput(cmdStr)
	s.Assert(c, err, IsNil, Commentf("output: %s", out))
	s.waitForStatToSucceed(c, nut, file)
}
開發者ID:contiv,項目名稱:cluster,代碼行數:6,代碼來源:utils.go


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