Merge pull request #1521 from XiShanYongYe-Chang/e2e-move-clean-operation

[E2E] move clean operation to AfterEach
This commit is contained in:
karmada-bot 2022-03-23 09:08:35 +08:00 committed by GitHub
commit e3271edc6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 26 additions and 22 deletions

View File

@ -257,6 +257,19 @@ var _ = ginkgo.Describe("[MCS] Multi-Cluster Service testing", func() {
framework.RemoveService(exportClusterClient, demoService.Namespace, demoService.Name)
})
ginkgo.AfterEach(func() {
ginkgo.By("Cleanup", func() {
err := controlPlaneClient.Delete(context.TODO(), &serviceExport)
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
err = controlPlaneClient.Delete(context.TODO(), &serviceImport)
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
})
framework.RemovePropagationPolicy(karmadaClient, exportPolicy.Namespace, exportPolicy.Name)
framework.RemovePropagationPolicy(karmadaClient, importPolicy.Namespace, importPolicy.Name)
})
ginkgo.It("Export Service from source-clusters, import Service to destination-clusters", func() {
importClusterClient := framework.GetClusterClient(serviceImportClusterName)
gomega.Expect(importClusterClient).ShouldNot(gomega.BeNil())
@ -346,17 +359,6 @@ var _ = ginkgo.Describe("[MCS] Multi-Cluster Service testing", func() {
return podLogs(context.TODO(), importClusterClient, demoService.Namespace, pod.Name)
}, pollTimeout, pollInterval).Should(gomega.Equal("hello\n"))
})
ginkgo.By("Cleanup", func() {
err := controlPlaneClient.Delete(context.TODO(), &serviceExport)
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
err = controlPlaneClient.Delete(context.TODO(), &serviceImport)
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
})
framework.RemovePropagationPolicy(karmadaClient, exportPolicy.Namespace, exportPolicy.Name)
framework.RemovePropagationPolicy(karmadaClient, importPolicy.Namespace, importPolicy.Name)
})
})
@ -400,6 +402,19 @@ var _ = ginkgo.Describe("[MCS] Multi-Cluster Service testing", func() {
framework.RemoveService(exportClusterClient, demoService.Namespace, demoService.Name)
})
ginkgo.AfterEach(func() {
ginkgo.By("Cleanup", func() {
err := controlPlaneClient.Delete(context.TODO(), &serviceExport)
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
err = controlPlaneClient.Delete(context.TODO(), &serviceImport)
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
})
framework.RemovePropagationPolicy(karmadaClient, exportPolicy.Namespace, exportPolicy.Name)
framework.RemovePropagationPolicy(karmadaClient, importPolicy.Namespace, importPolicy.Name)
})
ginkgo.It("Update Deployment's replicas", func() {
exportClusterClient := framework.GetClusterClient(serviceExportClusterName)
gomega.Expect(exportClusterClient).ShouldNot(gomega.BeNil())
@ -467,17 +482,6 @@ var _ = ginkgo.Describe("[MCS] Multi-Cluster Service testing", func() {
return epNums, nil
}, pollTimeout, pollInterval).Should(gomega.Equal(2))
})
ginkgo.By("Cleanup", func() {
err := controlPlaneClient.Delete(context.TODO(), &serviceExport)
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
err = controlPlaneClient.Delete(context.TODO(), &serviceImport)
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
})
framework.RemovePropagationPolicy(karmadaClient, exportPolicy.Namespace, exportPolicy.Name)
framework.RemovePropagationPolicy(karmadaClient, importPolicy.Namespace, importPolicy.Name)
})
})
})