Skip to content

Commit a1e3bcb

Browse files
committed
Add dry-run server test for imagestreamtag
1 parent a0471e8 commit a1e3bcb

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

test/extended/images/dryrun.go

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
})

test/extended/util/annotate/generated/zz_generated.annotations.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)