|
| 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 | +) |
| 11 | + |
| 12 | +var _ = g.Describe("[sig-imageregistry] Image --dry-run", func() { |
| 13 | + defer g.GinkgoRecover() |
| 14 | + |
| 15 | + var ( |
| 16 | + oc = exutil.NewCLIWithPodSecurityLevel("image-dry-run", admissionapi.LevelBaseline) |
| 17 | + ) |
| 18 | + |
| 19 | + g.It("should not delete resources [apigroup:image.openshift.io]", func() { |
| 20 | + g.By("preparing the image stream where the test image will be pushed") |
| 21 | + _, err := oc.Run("create").Args("imagestreamtag", "test:latest", "--from=tools:latest").Output() |
| 22 | + o.Expect(err).NotTo(o.HaveOccurred()) |
| 23 | + |
| 24 | + err = exutil.WaitForAnImageStreamTag(oc, oc.Namespace(), "test", "latest") |
| 25 | + o.Expect(err).NotTo(o.HaveOccurred()) |
| 26 | + |
| 27 | + g.By("triggering delete operation of istag with --dry-run=server") |
| 28 | + err = oc.Run("delete").Args("istag/test:latest", "--dry-run=server").Execute() |
| 29 | + o.Expect(err).NotTo(o.HaveOccurred()) |
| 30 | + |
| 31 | + g.By("obtaining the test:latest image name") |
| 32 | + _, err = oc.Run("get").Args("istag", "test:latest", "-o", "jsonpath={.image.metadata.name}").Output() |
| 33 | + o.Expect(err).NotTo(o.HaveOccurred()) |
| 34 | + |
| 35 | + g.By("triggering delete operation of imagestream with --dry-run=server") |
| 36 | + err = oc.Run("delete").Args("imagestream/test", "--dry-run=server").Execute() |
| 37 | + o.Expect(err).NotTo(o.HaveOccurred()) |
| 38 | + |
| 39 | + g.By("obtaining the test imagestream") |
| 40 | + _, err = oc.Run("get").Args("imagestream", "test", "-o", "jsonpath={.image.metadata.name}").Output() |
| 41 | + o.Expect(err).NotTo(o.HaveOccurred()) |
| 42 | + }) |
| 43 | +}) |
0 commit comments