本文整理汇总了Golang中github.com/contiv/remotessh.TestbedNode.RunCommandWithOutput方法的典型用法代码示例。如果您正苦于以下问题:Golang TestbedNode.RunCommandWithOutput方法的具体用法?Golang TestbedNode.RunCommandWithOutput怎么用?Golang TestbedNode.RunCommandWithOutput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/contiv/remotessh.TestbedNode
的用法示例。
在下文中一共展示了TestbedNode.RunCommandWithOutput方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: CheckBgpNoConnectionForaNode
func (s *systemtestSuite) CheckBgpNoConnectionForaNode(c *C, node remotessh.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")
}
示例2: waitDockerizedServicesHost
func waitDockerizedServicesHost(node remotessh.TestbedNode) error {
services := map[string]string{
"etcd": "etcdctl cluster-health",
}
for s, cmd := range services {
logrus.Infof("Waiting for %s on %q", s, node.GetName())
out, err := WaitForDone(
func() (string, bool) {
out, err := node.RunCommandWithOutput(cmd)
if err != nil {
return out, false
}
return out, true
}, 2*time.Second, time.Minute, fmt.Sprintf("service %s is not healthy", s))
if err != nil {
logrus.Infof("a dockerized service failed. Output: %s, Error: %v", out, err)
return err
}
}
return nil
}
示例3: ServiceStatus
//ServiceStatus queries and returns status result of systemd service unit
func ServiceStatus(n remotessh.TestbedNode, srv string) (string, error) {
return n.RunCommandWithOutput(fmt.Sprintf("systemctl status %s", srv))
}
示例4: ServiceLogs
//ServiceLogs queries and returns upto maxLogLines lines from systemd service unit logs
func ServiceLogs(n remotessh.TestbedNode, srv string, maxLogLines int) (string, error) {
return n.RunCommandWithOutput(fmt.Sprintf("sudo systemctl status -ln%d %s", maxLogLines, srv))
}
示例5: ServiceRestart
//ServiceRestart restarts a systemd service unit
func ServiceRestart(n remotessh.TestbedNode, srv string) (string, error) {
return n.RunCommandWithOutput(fmt.Sprintf("sudo systemctl restart %s", srv))
}