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


Golang Framework.WaitForPodTerminated方法代码示例

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


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

示例1: volumeTestCleanup

// Clean both server and client pods.
func volumeTestCleanup(f *framework.Framework, config VolumeTestConfig) {
	By(fmt.Sprint("cleaning the environment after ", config.prefix))

	defer GinkgoRecover()

	client := f.Client
	podClient := client.Pods(config.namespace)

	err := podClient.Delete(config.prefix+"-client", nil)
	if err != nil {
		// Log the error before failing test: if the test has already failed,
		// framework.ExpectNoError() won't print anything to logs!
		glog.Warningf("Failed to delete client pod: %v", err)
		framework.ExpectNoError(err, "Failed to delete client pod: %v", err)
	}

	if config.serverImage != "" {
		if err := f.WaitForPodTerminated(config.prefix+"-client", ""); !apierrs.IsNotFound(err) {
			framework.ExpectNoError(err, "Failed to wait client pod terminated: %v", err)
		}
		// See issue #24100.
		// Prevent umount errors by making sure making sure the client pod exits cleanly *before* the volume server pod exits.
		By("sleeping a bit so client can stop and unmount")
		time.Sleep(20 * time.Second)

		err = podClient.Delete(config.prefix+"-server", nil)
		if err != nil {
			glog.Warningf("Failed to delete server pod: %v", err)
			framework.ExpectNoError(err, "Failed to delete server pod: %v", err)
		}
	}
}
开发者ID:vikaschoudhary16,项目名称:kubernetes,代码行数:33,代码来源:volumes.go

示例2: deletePod

// Delete the passed in pod.
func deletePod(f *framework.Framework, c *client.Client, ns string, pod *api.Pod) error {

	framework.Logf("Deleting pod %v", pod.Name)
	err := c.Pods(ns).Delete(pod.Name, nil)
	if err != nil {
		return fmt.Errorf("Pod %v encountered a delete error: %v", pod.Name, err)
	}

	// Wait for pod to terminate
	err = f.WaitForPodTerminated(pod.Name, "")
	if err != nil && !apierrs.IsNotFound(err) {
		return fmt.Errorf("Pod %v will not teminate: %v", pod.Name, err)
	}

	// Re-get the pod to double check that it has been deleted; expect err
	// Note: Get() writes a log error if the pod is not found
	_, err = c.Pods(ns).Get(pod.Name)
	if err == nil {
		return fmt.Errorf("Pod %v has been deleted but able to re-Get the deleted pod", pod.Name)
	}
	if !apierrs.IsNotFound(err) {
		return fmt.Errorf("Pod %v has been deleted but still exists: %v", pod.Name, err)
	}

	framework.Logf("Ignore \"not found\" error above. Pod %v successfully deleted", pod.Name)
	return nil
}
开发者ID:AdoHe,项目名称:kubernetes,代码行数:28,代码来源:persistent_volumes.go

示例3: deletePod

// Delete the passed in pod.
func deletePod(f *framework.Framework, c clientset.Interface, ns string, pod *v1.Pod) {

	framework.Logf("Deleting pod %v", pod.Name)
	err := c.Core().Pods(ns).Delete(pod.Name, nil)
	Expect(err).NotTo(HaveOccurred())

	// Wait for pod to terminate.  Expect apierr NotFound
	err = f.WaitForPodTerminated(pod.Name, "")
	Expect(err).To(HaveOccurred())
	Expect(apierrs.IsNotFound(err)).To(BeTrue())

	framework.Logf("Ignore \"not found\" error above. Pod %v successfully deleted", pod.Name)
}
开发者ID:paralin,项目名称:kubernetes,代码行数:14,代码来源:persistent_volumes.go

示例4: deletePod

// Delete the passed in pod.
func deletePod(f *framework.Framework, c clientset.Interface, ns string, pod *v1.Pod) {
	if c != nil {
		if pod != nil && len(pod.Name) > 0 {
			framework.Logf("Deleting pod %v", pod.Name)
			err := c.Core().Pods(ns).Delete(pod.Name, nil)
			if err != nil && !apierrs.IsNotFound(err) {
				Expect(err).NotTo(HaveOccurred())
			}
			// Wait for pod to terminate.  Expect apierr NotFound
			err = f.WaitForPodTerminated(pod.Name, "")
			if err != nil && !apierrs.IsNotFound(err) {
				Expect(err).NotTo(HaveOccurred())
			}
			framework.Logf("Ignore \"not found\" error above. Pod %v successfully deleted", pod.Name)
		}
	}
}
开发者ID:kubernetes,项目名称:kubernetes,代码行数:18,代码来源:persistent_volumes.go


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