forked from openshift/origin
/
docker_pullsecret.go
63 lines (50 loc) · 2.04 KB
/
docker_pullsecret.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package builds
import (
"fmt"
g "github.com/onsi/ginkgo"
o "github.com/onsi/gomega"
"k8s.io/kubernetes/test/e2e"
exutil "github.com/openshift/origin/test/extended/util"
)
var _ = g.Describe("[builds][pullsecret][Conformance] docker build using a pull secret", func() {
defer g.GinkgoRecover()
const (
buildTestPod = "build-test-pod"
buildTestService = "build-test-svc"
)
var (
buildFixture = exutil.FixturePath("fixtures", "test-docker-build-pullsecret.json")
oc = exutil.NewCLI("docker-build-pullsecret", exutil.KubeConfigPath())
)
g.JustBeforeEach(func() {
g.By("waiting for builder service account")
err := exutil.WaitForBuilderAccount(oc.AdminKubeREST().ServiceAccounts(oc.Namespace()))
o.Expect(err).NotTo(o.HaveOccurred())
})
g.Describe("Building from a template", func() {
g.It("should create a docker build that pulls using a secret run it", func() {
oc.SetOutputDir(exutil.TestContext.OutputDir)
g.By(fmt.Sprintf("calling oc create -f %q", buildFixture))
err := oc.Run("create").Args("-f", buildFixture).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
g.By("starting a test build")
_, err = oc.Run("start-build").Args("docker-build").Output()
o.Expect(err).NotTo(o.HaveOccurred())
g.By("expecting the build succeeds")
err = exutil.WaitForABuild(oc.REST().Builds(oc.Namespace()), "docker-build-1", exutil.CheckBuildSuccessFn, exutil.CheckBuildFailedFn)
if err != nil {
logs, _ := oc.Run("build-logs").Args("docker-build-1").Output()
e2e.Failf("build failed: %s", logs)
}
g.By("starting a second build that pulls the image from the first build")
_, err = oc.Run("start-build").Args("docker-build-pull").Output()
o.Expect(err).NotTo(o.HaveOccurred())
g.By("expecting the build succeeds")
err = exutil.WaitForABuild(oc.REST().Builds(oc.Namespace()), "docker-build-pull-1", exutil.CheckBuildSuccessFn, exutil.CheckBuildFailedFn)
if err != nil {
logs, _ := oc.Run("build-logs").Args("docker-build-pull-1").Output()
e2e.Failf("build failed: %s", logs)
}
})
})
})