From d4c981032a129161aec2a6a6995ee207e19d131e Mon Sep 17 00:00:00 2001 From: Balazs Nadasdi Date: Thu, 7 Oct 2021 17:53:21 +0200 Subject: [PATCH] Fix containerd tests * Clean up at the end of TestImageService_Integration. * Clean up at the end of 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 47ce4bdd..7305fb77 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 b977e015..57f571cb 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 {