Merge pull request #1077 from ozhuraki/envtest-crud-and-upgrade

envtest: Fix upgrade test fail when the tests for CRUD operations fail
This commit is contained in:
Mikko Ylinen 2022-08-24 08:58:30 +03:00 committed by GitHub
commit 611b4d3a18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 36 additions and 0 deletions

View File

@ -128,4 +128,8 @@ var _ = Describe("DlbDevicePlugin Controller", func() {
Expect(dp.Spec.Image == image).To(BeTrue())
})
var _ = AfterEach(func() {
CleanupAfter("dlb", &devicepluginv1.DlbDevicePlugin{})
})
})

View File

@ -162,4 +162,8 @@ var _ = Describe("DsaDevicePlugin Controller", func() {
Expect(dp.Spec.Image == image).To(BeTrue())
Expect(dp.Spec.InitImage == initimage).To(BeTrue())
})
var _ = AfterEach(func() {
CleanupAfter("dsa", &devicepluginv1.DsaDevicePlugin{})
})
})

View File

@ -143,4 +143,8 @@ var _ = Describe("FpgaDevicePlugin Controller", func() {
Expect(dp.Spec.Image == image).To(BeTrue())
Expect(dp.Spec.InitImage == initimage).To(BeTrue())
})
var _ = AfterEach(func() {
CleanupAfter("fpga", &devicepluginv1.FpgaDevicePlugin{})
})
})

View File

@ -147,4 +147,8 @@ var _ = Describe("GpuDevicePlugin Controller", func() {
Expect(dp.Spec.Image == image).To(BeTrue())
Expect(dp.Spec.InitImage == initimage).To(BeTrue())
})
var _ = AfterEach(func() {
CleanupAfter("gpu", &devicepluginv1.GpuDevicePlugin{})
})
})

View File

@ -166,4 +166,8 @@ var _ = Describe("IaaDevicePlugin Controller", func() {
Expect(dp.Spec.Image == image).To(BeTrue())
})
var _ = AfterEach(func() {
CleanupAfter("iaa", &devicepluginv1.IaaDevicePlugin{})
})
})

View File

@ -177,4 +177,8 @@ var _ = Describe("QatDevicePlugin Controller", func() {
Expect(dp.Spec.Image == image).To(BeTrue())
Expect(dp.Spec.InitImage == initimage).To(BeTrue())
})
var _ = AfterEach(func() {
CleanupAfter("qat", &devicepluginv1.QatDevicePlugin{})
})
})

View File

@ -149,4 +149,8 @@ var _ = Describe("SgxDevicePlugin Controller", func() {
Expect(dp.Spec.Image == image).To(BeTrue())
Expect(dp.Spec.InitImage == initimage).To(BeTrue())
})
var _ = AfterEach(func() {
CleanupAfter("sgx", &devicepluginv1.SgxDevicePlugin{})
})
})

View File

@ -135,6 +135,14 @@ func up() {
time.Sleep(time.Second)
}
func CleanupAfter(name string, cr client.Object) {
namespacedName := types.NamespacedName{Namespace: ns, Name: name + "deviceplugin-test"}
if err := k8sClient.Get(ctx, namespacedName, cr); err == nil {
Expect(k8sClient.Delete(ctx, cr)).Should(Succeed())
}
}
func down() {
time.Sleep(time.Second)