Skip to content

Commit

Permalink
Fix containerd tests
Browse files Browse the repository at this point in the history
* Add cleaup in TestImageService_Integration.
* Add cleanup in TestMicroVMRepo_Integration_MultipleSave.
  • Loading branch information
yitsushi committed Oct 7, 2021
1 parent ca14a16 commit 20c17c1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion infrastructure/containerd/image_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 3 additions & 0 deletions infrastructure/containerd/repo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 20c17c1

Please sign in to comment.