From 20c17c155dbfbcde49e1c2131349abac415de604 Mon Sep 17 00:00:00 2001 From: Balazs Nadasdi Date: Thu, 7 Oct 2021 17:53:21 +0200 Subject: [PATCH] Fix containerd tests * Add cleaup in TestImageService_Integration. * Add cleanup in TestMicroVMRepo_Integration_MultipleSave. --- infrastructure/containerd/image_service_test.go | 8 +++++++- infrastructure/containerd/repo_test.go | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/infrastructure/containerd/image_service_test.go b/infrastructure/containerd/image_service_test.go index 47ce4bdd4..7305fb775 100644 --- a/infrastructure/containerd/image_service_test.go +++ b/infrastructure/containerd/image_service_test.go @@ -84,10 +84,16 @@ func TestImageService_Integration(t *testing.T) { Expect(len(leases)).To(Equal(1)) Expect(leases[0].ID).To(Equal(expectedLeaseName), "expect lease with name %s to exists", expectedLeaseName) - inputGet.ImageName = "docker.io/linuxkit/kernel:5.4.129" + inputGet.ImageName = testImageKernel err = imageSvc.Pull(ctx, inputGet) Expect(err).NotTo(HaveOccurred()) + + err = client.ImageService().Delete(namespaceCtx, testImageKernel) + Expect(err).NotTo(HaveOccurred()) + + err = client.ImageService().Delete(namespaceCtx, testImageVolume) + Expect(err).NotTo(HaveOccurred()) } func testCreateClient(t *testing.T) (*ctr.Client, context.Context) { diff --git a/infrastructure/containerd/repo_test.go b/infrastructure/containerd/repo_test.go index b977e0151..57f571cb0 100644 --- a/infrastructure/containerd/repo_test.go +++ b/infrastructure/containerd/repo_test.go @@ -92,6 +92,9 @@ func TestMicroVMRepo_Integration_MultipleSave(t *testing.T) { Expect(err).NotTo(HaveOccurred()) Expect(savedVM).NotTo(BeNil()) Expect(savedVM.Version).To(Equal(2)) + + err = repo.Delete(ctx, testVm) + Expect(err).NotTo(HaveOccurred()) } func makeSpec(name, ns string) *models.MicroVM {