本文整理汇总了Golang中github.com/contiv/remotessh.TestbedNode类的典型用法代码示例。如果您正苦于以下问题:Golang TestbedNode类的具体用法?Golang TestbedNode怎么用?Golang TestbedNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TestbedNode类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: restartDockerHost
func restartDockerHost(node remotessh.TestbedNode) error {
logrus.Infof("Restarting docker on %q", node.GetName())
// note that for all these restart tasks we error out quietly to avoid other
// hosts being cleaned up
node.RunCommand("sudo service docker restart")
return nil
}
开发者ID:contiv,项目名称:volplugin,代码行数:7,代码来源:util_test.go
示例2: restartNetplugin
func restartNetplugin(node remotessh.TestbedNode) error {
logrus.Infof("Restarting netplugin on %q", node.GetName())
err := node.RunCommand("sudo systemctl restart netplugin netmaster")
if err != nil {
return err
}
time.Sleep(5 * time.Second)
return nil
}
开发者ID:contiv,项目名称:volplugin,代码行数:9,代码来源:util_test.go
示例3: waitForVolplugin
func waitForVolplugin(node remotessh.TestbedNode) error {
logrus.Infof("Checking if volplugin is running on %q", node.GetName())
err := runCommandUntilNoError(node, "docker inspect -f {{.State.Running}} volplugin | grep true", 30)
if err == nil {
logrus.Infof("Volplugin is running on %q", node.GetName())
}
return nil
}
开发者ID:contiv,项目名称:volplugin,代码行数:9,代码来源:util_test.go
示例4: clearContainerHost
func (s *systemtestSuite) clearContainerHost(node remotessh.TestbedNode) error {
startedContainers.Lock()
names := []string{}
for name := range startedContainers.names {
names = append(names, name)
}
startedContainers.Unlock()
logrus.Infof("Clearing containers %v on %q", names, node.GetName())
node.RunCommand(fmt.Sprintf("docker rm -f %s", strings.Join(names, " ")))
return nil
}
开发者ID:contiv,项目名称:volplugin,代码行数:11,代码来源:util_test.go
示例5: runCommandUntilNoError
func runCommandUntilNoError(node remotessh.TestbedNode, cmd string, timeout int) error {
runCmd := func() (string, bool) {
if err := node.RunCommand(cmd); err != nil {
return "", false
}
return "", true
}
timeoutMessage := fmt.Sprintf("timeout reached trying to run %v on %q", cmd, node.GetName())
_, err := WaitForDone(runCmd, 10*time.Millisecond, time.Duration(timeout)*time.Second, timeoutMessage)
return err
}
开发者ID:contiv,项目名称:volplugin,代码行数:11,代码来源:util_test.go
示例6: 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")
}
开发者ID:abhinandanpb,项目名称:netplugin,代码行数:11,代码来源:bgp_test.go
示例7: 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
}
开发者ID:contiv,项目名称:volplugin,代码行数:22,代码来源:util_test.go
示例8: waitForAPIServer
func waitForAPIServer(node remotessh.TestbedNode) error {
logrus.Infof("Checking if apiserver is running on %q", node.GetName())
err := runCommandUntilNoError(node, "docker inspect -f {{.State.Running}} apiserver | grep true", 30)
if err == nil {
logrus.Infof("APIServer is running on %q", node.GetName())
}
then := time.Now()
err = runCommandUntilNoError(node, "connwait 127.0.0.1:9005", 60)
if err != nil {
return err
}
logrus.Infof("Took %s for apiserver on %q to be accessible", time.Since(then), node.GetName())
return nil
}
开发者ID:contiv,项目名称:volplugin,代码行数:16,代码来源:util_test.go
示例9: 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))
}
开发者ID:jojimt,项目名称:netplugin,代码行数:4,代码来源:system.go
示例10: 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))
}
开发者ID:jojimt,项目名称:netplugin,代码行数:4,代码来源:system.go
示例11: clearVolumeHost
func (s *systemtestSuite) clearVolumeHost(node remotessh.TestbedNode) error {
logrus.Infof("Clearing volumes on %q", node.GetName())
node.RunCommand("docker volume ls | tail -n +2 | awk '{ print $2 }' | xargs docker volume rm")
return nil
}
开发者ID:contiv,项目名称:volplugin,代码行数:5,代码来源:util_test.go
示例12: ClearEtcd
func ClearEtcd(node remotessh.TestbedNode) {
logrus.Info("Waiting for etcd")
node.RunCommand("while ! $(etcdctl cluster-health | tail -1 | grep -q 'cluster is healthy'); do sleep 1; done")
logrus.Info("Clearing etcd data")
node.RunCommand("etcdctl rm --recursive /volplugin")
}
开发者ID:contiv,项目名称:volplugin,代码行数:6,代码来源:util_test.go
示例13: startVolplugin
func startVolplugin(node remotessh.TestbedNode) error {
logrus.Infof("Starting the volplugin on %q", node.GetName())
return node.RunCommandBackground("sudo systemctl start volplugin")
}
开发者ID:contiv,项目名称:volplugin,代码行数:4,代码来源:util_test.go
示例14: stopAPIServer
func stopAPIServer(node remotessh.TestbedNode) error {
logrus.Infof("Stopping the apiserver on %q", node.GetName())
defer time.Sleep(time.Second)
return node.RunCommand("sudo systemctl stop apiserver")
}
开发者ID:contiv,项目名称:volplugin,代码行数:5,代码来源:util_test.go
示例15: startAPIServer
func startAPIServer(node remotessh.TestbedNode) error {
logrus.Infof("Starting the apiserver on %q", node.GetName())
err := node.RunCommandBackground("sudo systemctl start apiserver")
logrus.Infof("Waiting for apiserver startup on %q", node.GetName())
return err
}
开发者ID:contiv,项目名称:volplugin,代码行数:6,代码来源:util_test.go
示例16: ClearEtcd
func ClearEtcd(node remotessh.TestbedNode) {
log.Infof("Clearing etcd data")
node.RunCommand(`for i in $(etcdctl ls /); do etcdctl rm --recursive "$i"; done`)
}
开发者ID:jojimt,项目名称:netplugin,代码行数:4,代码来源:system.go
示例17: 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))
}
开发者ID:jojimt,项目名称:netplugin,代码行数:4,代码来源:system.go
示例18: stopVolplugin
func stopVolplugin(node remotessh.TestbedNode) error {
logrus.Infof("Stopping the volplugin on %q", node.GetName())
defer time.Sleep(time.Second)
return node.RunCommand("sudo systemctl stop volplugin")
}
开发者ID:contiv,项目名称:volplugin,代码行数:5,代码来源:util_test.go
注:本文中的github.com/contiv/remotessh.TestbedNode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论