diff --git a/cmd/cdi-importer/importer.go b/cmd/cdi-importer/importer.go index 66bf47859a..b072965f63 100644 --- a/cmd/cdi-importer/importer.go +++ b/cmd/cdi-importer/importer.go @@ -67,7 +67,7 @@ func main() { if source == controller.SourceNone && contentType == controller.ContentTypeKubevirt { requestImageSizeQuantity := resource.MustParse(imageSize) - minSizeQuantity := util.MinQuantity(resource.NewScaledQuantity(util.GetAvailableSpace(common.ImporterWritePath), 0), &requestImageSizeQuantity) + minSizeQuantity := util.MinQuantity(resource.NewScaledQuantity(util.GetAvailableSpace(common.ImporterVolumePath), 0), &requestImageSizeQuantity) if minSizeQuantity.Cmp(requestImageSizeQuantity) != 0 { // Available dest space is smaller than the size we want to create glog.Warningf("Available space less than requested size, creating blank image sized to availabe space: %s.\n", minSizeQuantity.String()) diff --git a/pkg/system/prlimit.go b/pkg/system/prlimit.go index 1b7a0e6887..b92e124efb 100644 --- a/pkg/system/prlimit.go +++ b/pkg/system/prlimit.go @@ -104,6 +104,8 @@ func processScanner(scanner *bufio.Scanner, buf *bytes.Buffer, done chan bool, c // ExecWithLimits executes a command with process limits func ExecWithLimits(limits *ProcessLimitValues, callback func(string), command string, args ...string) ([]byte, error) { + glog.Infof("ExecWithLimits %s, %+v", command, args) + var buf bytes.Buffer stdoutDone := make(chan bool) stderrDone := make(chan bool) diff --git a/tests/framework/pvc.go b/tests/framework/pvc.go index 42f9ed39db..c5f87039d0 100644 --- a/tests/framework/pvc.go +++ b/tests/framework/pvc.go @@ -71,7 +71,7 @@ func (f *Framework) VerifyTargetPVCContent(namespace *k8sv1.Namespace, pvc *k8sv // VerifyTargetPVCContentMD5 provides a function to check the md5 of data on a PVC and ensure it matches that which is provided func (f *Framework) VerifyTargetPVCContentMD5(namespace *k8sv1.Namespace, pvc *k8sv1.PersistentVolumeClaim, fileName string, expectedHash string) bool { - executorPod, err := utils.CreateExecutorPodWithPVC(f.K8sClient, "verify-pvc-content", namespace.Name, pvc) + executorPod, err := utils.CreateExecutorPodWithPVC(f.K8sClient, "verify-pvc-md5", namespace.Name, pvc) gomega.Expect(err).ToNot(gomega.HaveOccurred()) err = utils.WaitTimeoutForPodReady(f.K8sClient, executorPod.Name, namespace.Name, utils.PodWaitForTime) gomega.Expect(err).ToNot(gomega.HaveOccurred()) diff --git a/tests/import_test.go b/tests/import_test.go index 8be46149b3..e194d94d9f 100644 --- a/tests/import_test.go +++ b/tests/import_test.go @@ -26,6 +26,7 @@ const ( controllerSkipPVCCompleteTimeout = 90 * time.Second invalidEndpoint = "http://gopats.com/who-is-the-goat.iso" BlankImageCompleteTimeout = 60 * time.Second + BlankImageMD5 = "cd573cfaace07e7949bc0c46028904ff" ) var _ = Describe(testSuiteName, func() { @@ -84,6 +85,10 @@ var _ = Describe(testSuiteName, func() { Expect(phaseAnnotation).To(BeTrue()) return status }, BlankImageCompleteTimeout, assertionPollInterval).Should(BeEquivalentTo(v1.PodSucceeded)) + + By("Verify the image contents") + same := f.VerifyTargetPVCContentMD5(f.Namespace, pvc, utils.DefaultImagePath, BlankImageMD5) + Expect(same).To(BeTrue()) }) }) diff --git a/tests/upload_test.go b/tests/upload_test.go index 8367814495..7b2547a2d5 100644 --- a/tests/upload_test.go +++ b/tests/upload_test.go @@ -12,8 +12,6 @@ import ( "kubevirt.io/containerized-data-importer/tests/utils" ) -const testFile = utils.DefaultPvcMountPath + "/disk.img" - var _ = Describe("Upload tests", func() { f := framework.NewFrameworkOrDie("upload-func-test") @@ -50,7 +48,7 @@ var _ = Describe("Upload tests", func() { Expect(err).ToNot(HaveOccurred()) By("Verify content") - same := f.VerifyTargetPVCContentMD5(f.Namespace, pvc, testFile, utils.UploadFileMD5) + same := f.VerifyTargetPVCContentMD5(f.Namespace, pvc, utils.DefaultImagePath, utils.UploadFileMD5) Expect(same).To(BeTrue()) By("Delete upload PVC") diff --git a/tests/utils/pvc.go b/tests/utils/pvc.go index a8817c7dfd..f3fd040a25 100644 --- a/tests/utils/pvc.go +++ b/tests/utils/pvc.go @@ -22,6 +22,9 @@ const ( // DefaultPvcMountPath is the default mount path used DefaultPvcMountPath = "/pvc" + // DefaultImagePath is the default destination for images created by CDI + DefaultImagePath = DefaultPvcMountPath + "/disk.img" + pvcPollInterval = defaultPollInterval pvcCreateTime = defaultPollPeriod pvcDeleteTime = defaultPollPeriod