Skip to content

Commit a61518a

Browse files
committed
[sig-builds]: Migrate DCs to Deployments and remove [apigroup:apps.openshift.io] API dependency
1 parent a47fdb2 commit a61518a

File tree

7 files changed

+130
-152
lines changed

7 files changed

+130
-152
lines changed

test/extended/builds/volumes.go

+28-24
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,27 @@ package builds
22

33
import (
44
"path/filepath"
5-
"time"
65

76
g "github.com/onsi/ginkgo/v2"
87
o "github.com/onsi/gomega"
98

109
admissionapi "k8s.io/pod-security-admission/api"
1110

12-
deploymentutil "github.com/openshift/origin/test/extended/deployments"
1311
exutil "github.com/openshift/origin/test/extended/util"
1412
)
1513

1614
var _ = g.Describe("[sig-builds][Feature:Builds][volumes] build volumes", func() {
1715
var (
18-
oc = exutil.NewCLIWithPodSecurityLevel("build-volumes", admissionapi.LevelBaseline)
19-
baseDir = exutil.FixturePath("testdata", "builds", "volumes")
20-
secret = filepath.Join(baseDir, "secret.yaml")
21-
configmap = filepath.Join(baseDir, "configmap.yaml")
22-
s2iImageStream = filepath.Join(baseDir, "s2i-imagestream.yaml")
23-
s2iBuildConfig = filepath.Join(baseDir, "s2i-buildconfig.yaml")
24-
s2iDeploymentConfig = filepath.Join(baseDir, "s2i-deploymentconfig.yaml")
25-
dockerImageStream = filepath.Join(baseDir, "docker-imagestream.yaml")
26-
dockerBuildConfig = filepath.Join(baseDir, "docker-buildconfig.yaml")
27-
dockerDeploymentConfig = filepath.Join(baseDir, "docker-deploymentconfig.yaml")
16+
oc = exutil.NewCLIWithPodSecurityLevel("build-volumes", admissionapi.LevelBaseline)
17+
baseDir = exutil.FixturePath("testdata", "builds", "volumes")
18+
secret = filepath.Join(baseDir, "secret.yaml")
19+
configmap = filepath.Join(baseDir, "configmap.yaml")
20+
s2iImageStream = filepath.Join(baseDir, "s2i-imagestream.yaml")
21+
s2iBuildConfig = filepath.Join(baseDir, "s2i-buildconfig.yaml")
22+
s2iDeployment = filepath.Join(baseDir, "s2i-deployment.yaml")
23+
dockerImageStream = filepath.Join(baseDir, "docker-imagestream.yaml")
24+
dockerBuildConfig = filepath.Join(baseDir, "docker-buildconfig.yaml")
25+
dockerDeployment = filepath.Join(baseDir, "docker-deployment.yaml")
2826
)
2927

3028
g.Context("", func() {
@@ -51,7 +49,7 @@ var _ = g.Describe("[sig-builds][Feature:Builds][volumes] build volumes", func()
5149
}
5250
})
5351

54-
g.It("should mount given secrets and configmaps into the build pod for source strategy builds [apigroup:image.openshift.io][apigroup:build.openshift.io][apigroup:apps.openshift.io]", func() {
52+
g.It("should mount given secrets and configmaps into the build pod for source strategy builds [apigroup:image.openshift.io][apigroup:build.openshift.io]", func() {
5553
g.By("creating an imagestream")
5654
err := oc.Run("create").Args("-f", s2iImageStream).Execute()
5755
o.Expect(err).NotTo(o.HaveOccurred())
@@ -70,26 +68,29 @@ var _ = g.Describe("[sig-builds][Feature:Builds][volumes] build volumes", func()
7068
o.Expect(buildPodLogs).To(o.ContainSubstring("my-secret-value"))
7169
o.Expect(buildPodLogs).To(o.ContainSubstring("my-configmap-value"))
7270

73-
g.By("creating a deployment config")
74-
err = oc.Run("create").Args("-f", s2iDeploymentConfig).Execute()
71+
g.By("creating a deployment")
72+
err = oc.Run("create").Args("-f", s2iDeployment).Execute()
73+
o.Expect(err).NotTo(o.HaveOccurred())
74+
75+
projectName, err := oc.Run("project").Args("-q").Output()
7576
o.Expect(err).NotTo(o.HaveOccurred())
7677

7778
g.By("waiting for the deployment to complete")
78-
_, err = deploymentutil.WaitForDeployerToComplete(oc, "mys2itest-1", 5*time.Minute)
79+
err = exutil.WaitForDeploymentReady(oc, "mys2itest", projectName, -1)
7980
o.Expect(err).NotTo(o.HaveOccurred())
8081

8182
g.By("ensuring that the secret does not exist in the build image")
82-
out, err := oc.Run("rsh").Args("dc/mys2itest", "cat", "/var/run/secrets/some-secret/key").Output()
83+
out, err := oc.Run("rsh").Args("deployment/mys2itest", "cat", "/var/run/secrets/some-secret/key").Output()
8384
o.Expect(err).To(o.HaveOccurred())
8485
o.Expect(out).To(o.ContainSubstring("cat: /var/run/secrets/some-secret/key: No such file or directory"))
8586

8687
g.By("ensuring that the configmap does not exist in the build image")
87-
out, err = oc.Run("rsh").Args("dc/mys2itest", "cat", "/var/run/configmaps/some-configmap/key").Output()
88+
out, err = oc.Run("rsh").Args("deployment/mys2itest", "cat", "/var/run/configmaps/some-configmap/key").Output()
8889
o.Expect(err).To(o.HaveOccurred())
8990
o.Expect(out).To(o.ContainSubstring("cat: /var/run/configmaps/some-configmap/key: No such file or directory"))
9091
})
9192

92-
g.It("should mount given secrets and configmaps into the build pod for docker strategy builds [apigroup:image.openshift.io][apigroup:build.openshift.io][apigroup:apps.openshift.io]", func() {
93+
g.It("should mount given secrets and configmaps into the build pod for docker strategy builds [apigroup:image.openshift.io][apigroup:build.openshift.io]", func() {
9394
g.By("creating an imagestream")
9495
err := oc.Run("create").Args("-f", dockerImageStream).Execute()
9596
o.Expect(err).NotTo(o.HaveOccurred())
@@ -108,21 +109,24 @@ var _ = g.Describe("[sig-builds][Feature:Builds][volumes] build volumes", func()
108109
o.Expect(buildPodLogs).To(o.ContainSubstring("my-secret-value"))
109110
o.Expect(buildPodLogs).To(o.ContainSubstring("my-configmap-value"))
110111

111-
g.By("creating a deployment config")
112-
err = oc.Run("create").Args("-f", dockerDeploymentConfig).Execute()
112+
g.By("creating a deployment")
113+
err = oc.Run("create").Args("-f", dockerDeployment).Execute()
114+
o.Expect(err).NotTo(o.HaveOccurred())
115+
116+
projectName, err := oc.Run("project").Args("-q").Output()
113117
o.Expect(err).NotTo(o.HaveOccurred())
114118

115119
g.By("waiting for the deployment to complete")
116-
_, err = deploymentutil.WaitForDeployerToComplete(oc, "mydockertest-1", 5*time.Minute)
120+
err = exutil.WaitForDeploymentReady(oc, "mydockertest", projectName, -1)
117121
o.Expect(err).NotTo(o.HaveOccurred())
118122

119123
g.By("ensuring that the secret does not exist in the build image")
120-
out, err := oc.Run("rsh").Args("dc/mydockertest", "cat", "/var/run/secrets/some-secret/key").Output()
124+
out, err := oc.Run("rsh").Args("deployment/mydockertest", "cat", "/var/run/secrets/some-secret/key").Output()
121125
o.Expect(err).To(o.HaveOccurred())
122126
o.Expect(out).To(o.ContainSubstring("cat: /var/run/secrets/some-secret/key: No such file or directory"))
123127

124128
g.By("ensuring that the configmap does not exist in the build image")
125-
out, err = oc.Run("rsh").Args("dc/mydockertest", "cat", "/var/run/configmaps/some-configmap/key").Output()
129+
out, err = oc.Run("rsh").Args("deployment/mydockertest", "cat", "/var/run/configmaps/some-configmap/key").Output()
126130
o.Expect(err).To(o.HaveOccurred())
127131
o.Expect(out).To(o.ContainSubstring("cat: /var/run/configmaps/some-configmap/key: No such file or directory"))
128132
})

test/extended/testdata/bindata.go

+44-56
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: mydockertest
5+
annotations:
6+
image.openshift.io/triggers: "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"mydockerstream:latest\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]"
7+
spec:
8+
replicas: 1
9+
selector:
10+
matchLabels:
11+
app: mydockertest
12+
deployment: mydockertest
13+
strategy:
14+
type: RollingUpdate
15+
template:
16+
metadata:
17+
labels:
18+
app: mydockertest
19+
deployment: mydockertest
20+
spec:
21+
containers:
22+
- image: " "
23+
imagePullPolicy: Always
24+
name: mydockertest
25+
terminationMessagePath: /dev/termination-log
26+
dnsPolicy: ClusterFirst
27+
restartPolicy: Always
28+
securityContext: {}

test/extended/testdata/builds/volumes/docker-deploymentconfig.yaml

-35
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: mys2itest
5+
annotations:
6+
image.openshift.io/triggers: "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"mys2istream:latest\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]"
7+
spec:
8+
replicas: 1
9+
selector:
10+
matchLabels:
11+
app: mys2itest
12+
deployment: mys2itest
13+
strategy:
14+
type: RollingUpdate
15+
template:
16+
metadata:
17+
labels:
18+
app: mys2itest
19+
deployment: mys2itest
20+
spec:
21+
containers:
22+
- image: " "
23+
imagePullPolicy: Always
24+
name: mys2itest
25+
terminationMessagePath: /dev/termination-log
26+
dnsPolicy: ClusterFirst
27+
restartPolicy: Always
28+
securityContext: {}

0 commit comments

Comments
 (0)