mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-19 08:54:44 +00:00
Merge pull request #88016 from jsafrane/wait-for-pod-deletion
Delete pod in volume tests
This commit is contained in:
@@ -328,21 +328,17 @@ func startVolumeServer(client clientset.Interface, config TestConfig) *v1.Pod {
|
||||
return pod
|
||||
}
|
||||
|
||||
// TestCleanup cleans both server and client pods.
|
||||
func TestCleanup(f *framework.Framework, config TestConfig) {
|
||||
// TestServerCleanup cleans server pod.
|
||||
func TestServerCleanup(f *framework.Framework, config TestConfig) {
|
||||
ginkgo.By(fmt.Sprint("cleaning the environment after ", config.Prefix))
|
||||
|
||||
defer ginkgo.GinkgoRecover()
|
||||
|
||||
cs := f.ClientSet
|
||||
|
||||
err := e2epod.DeletePodWithWaitByName(cs, config.Prefix+"-client", config.Namespace)
|
||||
gomega.Expect(err).To(gomega.BeNil(), "Failed to delete pod %v in namespace %v", config.Prefix+"-client", config.Namespace)
|
||||
|
||||
if config.ServerImage != "" {
|
||||
err := e2epod.DeletePodWithWaitByName(cs, config.Prefix+"-server", config.Namespace)
|
||||
gomega.Expect(err).To(gomega.BeNil(), "Failed to delete pod %v in namespace %v", config.Prefix+"-server", config.Namespace)
|
||||
if config.ServerImage == "" {
|
||||
return
|
||||
}
|
||||
|
||||
err := e2epod.DeletePodWithWaitByName(f.ClientSet, config.Prefix+"-server", config.Namespace)
|
||||
gomega.Expect(err).To(gomega.BeNil(), "Failed to delete pod %v in namespace %v", config.Prefix+"-server", config.Namespace)
|
||||
}
|
||||
|
||||
func runVolumeTesterPod(client clientset.Interface, config TestConfig, podSuffix string, privileged bool, fsGroup *int64, tests []Test) (*v1.Pod, error) {
|
||||
@@ -479,8 +475,12 @@ func TestVolumeClient(f *framework.Framework, config TestConfig, fsGroup *int64,
|
||||
clientPod, err := runVolumeTesterPod(f.ClientSet, config, "client", false, fsGroup, tests)
|
||||
if err != nil {
|
||||
framework.Failf("Failed to create client pod: %v", err)
|
||||
|
||||
}
|
||||
defer func() {
|
||||
e2epod.DeletePodOrFail(f.ClientSet, clientPod.Namespace, clientPod.Name)
|
||||
e2epod.WaitForPodToDisappear(f.ClientSet, clientPod.Namespace, clientPod.Name, labels.Everything(), framework.Poll, framework.PodDeleteTimeout)
|
||||
}()
|
||||
|
||||
framework.ExpectNoError(e2epod.WaitForPodRunningInNamespace(f.ClientSet, clientPod))
|
||||
testVolumeContent(f, clientPod, fsGroup, fsType, tests)
|
||||
}
|
||||
|
Reference in New Issue
Block a user