From 93623154836a51e16caa0fd88783e7b1c5d6d710 Mon Sep 17 00:00:00 2001 From: Matthias Diester Date: Fri, 14 Jun 2024 15:01:23 +0200 Subject: [PATCH] Refactor test asset directory look-up Simplify the look-up for the test asset directory. No need for path cleaning function since it is a test case and the look-up is relative by default, so there is no need to look-up the current working directory. --- cmd/image-processing/main_test.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/cmd/image-processing/main_test.go b/cmd/image-processing/main_test.go index 1c1f01c89f..0096580161 100644 --- a/cmd/image-processing/main_test.go +++ b/cmd/image-processing/main_test.go @@ -405,12 +405,7 @@ var _ = Describe("Image Processing Resource", Ordered, func() { }) Context("vulnerability scanning", func() { - var directory string - BeforeEach(func() { - cwd, err := os.Getwd() - Expect(err).ToNot(HaveOccurred()) - directory = path.Clean(path.Join(cwd, "../..", "test/data/images/vuln-image-in-oci")) - }) + directory := path.Join("..", "..", "test", "data", "images", "vuln-image-in-oci") It("should run vulnerability scanning if it is enabled and output vulnerabilities equal to the limit defined", func() { vulnOptions := &buildapi.VulnerabilityScanOptions{ @@ -491,7 +486,6 @@ var _ = Describe("Image Processing Resource", Ordered, func() { _, err = remote.Get(ref) Expect(err).To(HaveOccurred()) - }) }) @@ -540,6 +534,5 @@ var _ = Describe("Image Processing Resource", Ordered, func() { Expect(err).ToNot(HaveOccurred()) }) }) - }) })