当前位置: 首页>>代码示例>>Golang>>正文


Golang framework.RunCmd函数代码示例

本文整理汇总了Golang中k8s/io/kubernetes/test/e2e/framework.RunCmd函数的典型用法代码示例。如果您正苦于以下问题:Golang RunCmd函数的具体用法?Golang RunCmd怎么用?Golang RunCmd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了RunCmd函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: removeMasterReplica

func removeMasterReplica(zone string) error {
	framework.Logf(fmt.Sprintf("Removing an existing master replica, zone: %s", zone))
	v, _, err := framework.RunCmd(path.Join(framework.TestContext.RepoRoot, "hack/e2e-internal/e2e-remove-master.sh"), zone, "true")
	framework.Logf("%s", v)
	if err != nil {
		return err
	}
	return nil
}
开发者ID:jonboulle,项目名称:kubernetes,代码行数:9,代码来源:ha_master.go

示例2: addMasterReplica

func addMasterReplica(zone string) error {
	framework.Logf(fmt.Sprintf("Adding a new master replica, zone: %s", zone))
	v, _, err := framework.RunCmd(path.Join(framework.TestContext.RepoRoot, "hack/e2e-internal/e2e-add-master.sh"), zone)
	framework.Logf("%s", v)
	if err != nil {
		return err
	}
	return nil
}
开发者ID:jonboulle,项目名称:kubernetes,代码行数:9,代码来源:ha_master.go

示例3: removeWorkerNodes

func removeWorkerNodes(zone string) error {
	framework.Logf(fmt.Sprintf("Removing worker nodes, zone: %s", zone))
	v, _, err := framework.RunCmd(path.Join(framework.TestContext.RepoRoot, "hack/e2e-internal/e2e-shrink-cluster.sh"), zone, "true", "true", "true")
	framework.Logf("%s", v)
	if err != nil {
		return err
	}
	return nil
}
开发者ID:kubernetes,项目名称:kubernetes,代码行数:9,代码来源:ha_master.go

示例4: realVersion

// realVersion turns a version constant s into a version string deployable on
// GKE.  See hack/get-build.sh for more information.
func realVersion(s string) (string, error) {
	framework.Logf(fmt.Sprintf("Getting real version for %q", s))
	v, _, err := framework.RunCmd(path.Join(framework.TestContext.RepoRoot, "hack/get-build.sh"), "-v", s)
	if err != nil {
		return v, err
	}
	framework.Logf("Version for %q is %q", s, v)
	return strings.TrimPrefix(strings.TrimSpace(v), "v"), nil
}
开发者ID:alex-mohr,项目名称:kubernetes,代码行数:11,代码来源:cluster_upgrade.go

示例5: restartNodes

func restartNodes(f *framework.Framework, nodeNames []string) error {
	// List old boot IDs.
	oldBootIDs := make(map[string]string)
	for _, name := range nodeNames {
		node, err := f.Client.Nodes().Get(name)
		if err != nil {
			return fmt.Errorf("error getting node info before reboot: %s", err)
		}
		oldBootIDs[name] = node.Status.NodeInfo.BootID
	}
	// Reboot the nodes.
	args := []string{
		"compute",
		fmt.Sprintf("--project=%s", framework.TestContext.CloudConfig.ProjectID),
		"instances",
		"reset",
	}
	args = append(args, nodeNames...)
	args = append(args, fmt.Sprintf("--zone=%s", framework.TestContext.CloudConfig.Zone))
	stdout, stderr, err := framework.RunCmd("gcloud", args...)
	if err != nil {
		return fmt.Errorf("error restarting nodes: %s\nstdout: %s\nstderr: %s", err, stdout, stderr)
	}
	// Wait for their boot IDs to change.
	for _, name := range nodeNames {
		if err := wait.Poll(30*time.Second, 5*time.Minute, func() (bool, error) {
			node, err := f.Client.Nodes().Get(name)
			if err != nil {
				return false, fmt.Errorf("error getting node info after reboot: %s", err)
			}
			return node.Status.NodeInfo.BootID != oldBootIDs[name], nil
		}); err != nil {
			return fmt.Errorf("error waiting for node %s boot ID to change: %s", name, err)
		}
	}
	return nil
}
开发者ID:Random-Liu,项目名称:kubernetes,代码行数:37,代码来源:restart.go


注:本文中的k8s/io/kubernetes/test/e2e/framework.RunCmd函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。