|
| 1 | +package images |
| 2 | + |
| 3 | +import ( |
| 4 | + g "github.com/onsi/ginkgo/v2" |
| 5 | + o "github.com/onsi/gomega" |
| 6 | + |
| 7 | + admissionapi "k8s.io/pod-security-admission/api" |
| 8 | + |
| 9 | + exutil "github.com/openshift/origin/test/extended/util" |
| 10 | + "github.com/openshift/origin/test/extended/util/image" |
| 11 | +) |
| 12 | + |
| 13 | +var _ = g.Describe("[sig-imageregistry] Image --dry-run", func() { |
| 14 | + defer g.GinkgoRecover() |
| 15 | + |
| 16 | + var ( |
| 17 | + oc = exutil.NewCLIWithPodSecurityLevel("image-dry-run", admissionapi.LevelBaseline) |
| 18 | + ) |
| 19 | + |
| 20 | + g.It("should not delete resources [apigroup:image.openshift.io]", func() { |
| 21 | + g.By("preparing the image stream where the test image will be pushed") |
| 22 | + err := oc.Run("tag").Args("--source=docker", image.ShellImage(), "test:latest").Execute() |
| 23 | + o.Expect(err).NotTo(o.HaveOccurred()) |
| 24 | + |
| 25 | + err = exutil.WaitForAnImageStreamTag(oc, oc.Namespace(), "test", "latest") |
| 26 | + o.Expect(err).NotTo(o.HaveOccurred()) |
| 27 | + |
| 28 | + g.By("triggering delete operation of istag with --dry-run=server") |
| 29 | + err = oc.Run("delete").Args("istag/test:latest", "--dry-run=server").Execute() |
| 30 | + o.Expect(err).NotTo(o.HaveOccurred()) |
| 31 | + |
| 32 | + g.By("obtaining the test:latest image name") |
| 33 | + _, err = oc.Run("get").Args("istag", "test:latest", "-o", "jsonpath={.image.metadata.name}").Output() |
| 34 | + o.Expect(err).NotTo(o.HaveOccurred()) |
| 35 | + |
| 36 | + g.By("triggering delete operation of imagestream with --dry-run=server") |
| 37 | + err = oc.Run("delete").Args("imagestream/test", "--dry-run=server").Execute() |
| 38 | + o.Expect(err).NotTo(o.HaveOccurred()) |
| 39 | + |
| 40 | + g.By("obtaining the test imagestream") |
| 41 | + _, err = oc.Run("get").Args("imagestream", "test", "-o", "jsonpath={.image.metadata.name}").Output() |
| 42 | + o.Expect(err).NotTo(o.HaveOccurred()) |
| 43 | + }) |
| 44 | +}) |
0 commit comments