@@ -2,29 +2,27 @@ package builds
2
2
3
3
import (
4
4
"path/filepath"
5
- "time"
6
5
7
6
g "github.com/onsi/ginkgo/v2"
8
7
o "github.com/onsi/gomega"
9
8
10
9
admissionapi "k8s.io/pod-security-admission/api"
11
10
12
- deploymentutil "github.com/openshift/origin/test/extended/deployments"
13
11
exutil "github.com/openshift/origin/test/extended/util"
14
12
)
15
13
16
14
var _ = g .Describe ("[sig-builds][Feature:Builds][volumes] build volumes" , func () {
17
15
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" )
28
26
)
29
27
30
28
g .Context ("" , func () {
@@ -51,7 +49,7 @@ var _ = g.Describe("[sig-builds][Feature:Builds][volumes] build volumes", func()
51
49
}
52
50
})
53
51
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 () {
55
53
g .By ("creating an imagestream" )
56
54
err := oc .Run ("create" ).Args ("-f" , s2iImageStream ).Execute ()
57
55
o .Expect (err ).NotTo (o .HaveOccurred ())
@@ -70,26 +68,29 @@ var _ = g.Describe("[sig-builds][Feature:Builds][volumes] build volumes", func()
70
68
o .Expect (buildPodLogs ).To (o .ContainSubstring ("my-secret-value" ))
71
69
o .Expect (buildPodLogs ).To (o .ContainSubstring ("my-configmap-value" ))
72
70
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 ()
75
76
o .Expect (err ).NotTo (o .HaveOccurred ())
76
77
77
78
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 )
79
80
o .Expect (err ).NotTo (o .HaveOccurred ())
80
81
81
82
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 ()
83
84
o .Expect (err ).To (o .HaveOccurred ())
84
85
o .Expect (out ).To (o .ContainSubstring ("cat: /var/run/secrets/some-secret/key: No such file or directory" ))
85
86
86
87
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 ()
88
89
o .Expect (err ).To (o .HaveOccurred ())
89
90
o .Expect (out ).To (o .ContainSubstring ("cat: /var/run/configmaps/some-configmap/key: No such file or directory" ))
90
91
})
91
92
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 () {
93
94
g .By ("creating an imagestream" )
94
95
err := oc .Run ("create" ).Args ("-f" , dockerImageStream ).Execute ()
95
96
o .Expect (err ).NotTo (o .HaveOccurred ())
@@ -108,21 +109,24 @@ var _ = g.Describe("[sig-builds][Feature:Builds][volumes] build volumes", func()
108
109
o .Expect (buildPodLogs ).To (o .ContainSubstring ("my-secret-value" ))
109
110
o .Expect (buildPodLogs ).To (o .ContainSubstring ("my-configmap-value" ))
110
111
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 ()
113
117
o .Expect (err ).NotTo (o .HaveOccurred ())
114
118
115
119
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 )
117
121
o .Expect (err ).NotTo (o .HaveOccurred ())
118
122
119
123
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 ()
121
125
o .Expect (err ).To (o .HaveOccurred ())
122
126
o .Expect (out ).To (o .ContainSubstring ("cat: /var/run/secrets/some-secret/key: No such file or directory" ))
123
127
124
128
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 ()
126
130
o .Expect (err ).To (o .HaveOccurred ())
127
131
o .Expect (out ).To (o .ContainSubstring ("cat: /var/run/configmaps/some-configmap/key: No such file or directory" ))
128
132
})
0 commit comments