Skip to content

Commit 3c28ed4

Browse files
author
OpenShift Bot
authored
Merge pull request #11754 from coreydaley/fix_extended_tests_for_custom_strategy
Merged by openshift-bot
2 parents 046fad4 + a914fb7 commit 3c28ed4

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/extended/builds/forcepull.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ func doTest(bldPrefix, debugStr string, same bool, oc *exutil.CLI) {
3838
// corrupt the builder image
3939
exutil.CorruptImage(fullImageName, corruptor)
4040

41+
if bldPrefix == buildPrefixFC || bldPrefix == buildPrefixTC {
42+
// grant access to the custom build strategy
43+
err := oc.AsAdmin().Run("adm").Args("policy", "add-cluster-role-to-user", "system:build-strategy-custom", oc.Username()).Execute()
44+
o.Expect(err).NotTo(o.HaveOccurred())
45+
defer func() {
46+
err = oc.AsAdmin().Run("adm").Args("policy", "remove-cluster-role-from-user", "system:build-strategy-custom", oc.Username()).Execute()
47+
o.Expect(err).NotTo(o.HaveOccurred())
48+
}()
49+
}
50+
4151
// kick off the app/lang build and verify the builder image accordingly
4252
_, err := exutil.StartBuildAndWait(oc, bldPrefix)
4353
o.ExpectWithOffset(1, err).NotTo(o.HaveOccurred())
@@ -110,6 +120,17 @@ var _ = g.Describe("[LocalNode][builds] forcePull should affect pulling builder
110120
pre := exutil.FixturePath("testdata", "forcepull-test.json")
111121
post := exutil.ArtifactPath("forcepull-test.json")
112122
varSubDest = authCfg.ServerAddress + "/" + oc.Namespace()
123+
124+
// grant access to the custom build strategy
125+
g.By("granting system:build-strategy-custom")
126+
err = oc.AsAdmin().Run("adm").Args("policy", "add-cluster-role-to-user", "system:build-strategy-custom", oc.Username()).Execute()
127+
o.Expect(err).NotTo(o.HaveOccurred())
128+
129+
defer func() {
130+
err = oc.AsAdmin().Run("adm").Args("policy", "remove-cluster-role-from-user", "system:build-strategy-custom", oc.Username()).Execute()
131+
o.Expect(err).NotTo(o.HaveOccurred())
132+
}()
133+
113134
err = exutil.VarSubOnFile(pre, post, varSubSrc, varSubDest)
114135
o.Expect(err).NotTo(o.HaveOccurred())
115136
err = exutil.CreateResource(post, oc)

0 commit comments

Comments
 (0)