forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
jenkins_autoprovision.go
57 lines (43 loc) · 1.65 KB
/
jenkins_autoprovision.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
package builds
import (
"fmt"
"time"
g "github.com/onsi/ginkgo"
o "github.com/onsi/gomega"
exutil "github.com/openshift/origin/test/extended/util"
)
var _ = g.Describe("[Feature:Builds][Conformance] jenkins autoprovision", func() {
defer g.GinkgoRecover()
var (
envVarsPipelinePath = exutil.FixturePath("testdata", "samplepipeline-withenvs.yaml")
oc = exutil.NewCLI("jenkins-pipeline", exutil.KubeConfigPath())
jenkinsPodLabel = exutil.ParseLabelsOrDie("deploymentconfig=jenkins")
)
g.Context("Pipeline build config", func() {
g.BeforeEach(func() {
exutil.DumpDockerInfo()
g.By("waiting for default service account")
err := exutil.WaitForServiceAccount(oc.KubeClient().Core().ServiceAccounts(oc.Namespace()), "default")
o.Expect(err).NotTo(o.HaveOccurred())
g.By("waiting for builder service account")
err = exutil.WaitForServiceAccount(oc.KubeClient().Core().ServiceAccounts(oc.Namespace()), "builder")
o.Expect(err).NotTo(o.HaveOccurred())
})
g.AfterEach(func() {
if g.CurrentGinkgoTestDescription().Failed {
exutil.DumpPodStates(oc)
exutil.DumpPodLogsStartingWith("", oc)
}
})
g.It("should autoprovision jenkins", func() {
// instantiate the bc
g.By(fmt.Sprintf("calling oc new-app -f %q", envVarsPipelinePath))
err := oc.Run("new-app").Args("-f", envVarsPipelinePath).Execute()
o.Expect(err).NotTo(o.HaveOccurred())
// confirm jenkins pod is started
pods, err := exutil.WaitForPods(oc.KubeClient().Core().Pods(oc.Namespace()), jenkinsPodLabel, exutil.CheckPodNoOp, 1, 5*time.Minute)
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(len(pods)).To(o.Equal(1))
})
})
})