Skip to content

Commit

Permalink
Merge pull request #11252 from jupierce/jenkinstests
Browse files Browse the repository at this point in the history
Merged by openshift-bot
  • Loading branch information
OpenShift Bot authored Oct 26, 2016
2 parents 3f5cad6 + 24eca1b commit ca101d7
Show file tree
Hide file tree
Showing 14 changed files with 1,297 additions and 209 deletions.
58 changes: 23 additions & 35 deletions examples/jenkins/application-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"apiVersion": "v1",
"metadata": {
"name": "nodejs-helloworld-sample",
"creationTimestamp": null,
"annotations": {
"description": "This example shows how to create a simple nodejs application in openshift origin v3",
"iconClass": "icon-nodejs",
Expand All @@ -15,8 +14,7 @@
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "frontend-prod",
"creationTimestamp": null
"name": "frontend-prod"
},
"spec": {
"ports": [
Expand All @@ -42,8 +40,7 @@
"kind": "Route",
"apiVersion": "v1",
"metadata": {
"name": "frontend",
"creationTimestamp": null
"name": "frontend"
},
"spec": {
"to": {
Expand All @@ -59,8 +56,7 @@
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {
"name": "frontend-prod",
"creationTimestamp": null
"name": "frontend-prod"
},
"spec": {
"strategy": {
Expand Down Expand Up @@ -95,7 +91,6 @@
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"name": "frontend-prod"
}
Expand Down Expand Up @@ -128,16 +123,14 @@
"dnsPolicy": "ClusterFirst"
}
}
},
"status": {}
}
},

{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "frontend",
"creationTimestamp": null
"name": "frontend"
},
"spec": {
"ports": [
Expand All @@ -154,43 +147,44 @@
},
"type": "ClusterIP",
"sessionAffinity": "None"
},
"status": {
"loadBalancer": {}
}
},
{
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
"name": "origin-nodejs-sample",
"creationTimestamp": null
},
"spec": {},
"status": {
"dockerImageRepository": ""
"name": "origin-nodejs-sample"
}
},
{
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
"name": "origin-nodejs-sample2"
}
},
{
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
"name": "origin-nodejs-sample3"
}
},
{
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
"name": "nodejs-010-centos7",
"creationTimestamp": null
"name": "nodejs-010-centos7"
},
"spec": {
"dockerImageRepository": "${NAMESPACE}/nodejs-010-centos7"
},
"status": {
"dockerImageRepository": ""
}
},
{
"kind": "BuildConfig",
"apiVersion": "v1",
"metadata": {
"name": "frontend",
"creationTimestamp": null,
"labels": {
"name": "nodejs-sample-build"
}
Expand Down Expand Up @@ -232,17 +226,13 @@
}
},
"resources": {}
},
"status": {
"lastVersion": 0
}
},
{
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {
"name": "frontend",
"creationTimestamp": null
"name": "frontend"
},
"spec": {
"strategy": {
Expand Down Expand Up @@ -277,7 +267,6 @@
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"name": "frontend"
}
Expand Down Expand Up @@ -310,8 +299,7 @@
"dnsPolicy": "ClusterFirst"
}
}
},
"status": {}
}
}
],
"parameters": [
Expand Down
1 change: 1 addition & 0 deletions examples/jenkins/jenkins-ephemeral-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"livenessProbe": {
"timeoutSeconds": 3,
"initialDelaySeconds": 120,
"failureThreshold" : 30,
"httpGet": {
"path": "/login",
"port": 8080
Expand Down
1 change: 1 addition & 0 deletions examples/jenkins/jenkins-persistent-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
"livenessProbe": {
"timeoutSeconds": 3,
"initialDelaySeconds": 120,
"failureThreshold" : 30,
"httpGet": {
"path": "/login",
"port": 8080
Expand Down
2 changes: 2 additions & 0 deletions pkg/bootstrap/bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 14 additions & 5 deletions test/extended/image_ecosystem/kubernetes_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ var _ = g.Describe("[image_ecosystem][jenkins] schedule jobs on pod slaves", fun
o.Expect(err).NotTo(o.HaveOccurred())

g.By("grant service account in jenkins container access to API")
err = oc.Run("policy").Args("add-role-to-user", "edit", "system:serviceaccount:"+oc.Namespace()+":default", "-n", oc.Namespace()).Execute()
err = oc.Run("policy").Args("add-role-to-user", "edit", "system:serviceaccount:"+oc.Namespace()+":jenkins", "-n", oc.Namespace()).Execute()
o.Expect(err).NotTo(o.HaveOccurred())

g.By("instantiate the master template")
Expand All @@ -131,11 +131,20 @@ var _ = g.Describe("[image_ecosystem][jenkins] schedule jobs on pod slaves", fun
o.Expect(err).NotTo(o.HaveOccurred())
o.Expect(port).NotTo(o.BeEmpty())

jenkinsUri := fmt.Sprintf("http://%s:%s", serviceIP, port)
g.By(fmt.Sprintf("wait for jenkins to come up at %q", jenkinsUri))
g.By("get admin password")
password := getAdminPassword(oc)
o.Expect(password).ShouldNot(o.BeEmpty())
err = waitForJenkinsActivity(jenkinsUri, password, "", 200)

j := JenkinsRef{
oc: oc,
host: serviceIP,
port: port,
password: password,
namespace: oc.Namespace(),
}

g.By(fmt.Sprintf("wait for jenkins to come up at http://%s:%s", serviceIP, port))
_, err = j.waitForContent("", 200, 3*time.Minute, "")
o.Expect(err).NotTo(o.HaveOccurred())

g.By("inspecting the Jenkins master logs the slave image should be registered")
Expand All @@ -144,7 +153,7 @@ var _ = g.Describe("[image_ecosystem][jenkins] schedule jobs on pod slaves", fun
o.Expect(out).To(o.ContainSubstring("Adding image ruby-22-centos7-jenkins-slave:latest as Kubernetes slave"))

g.By("kick the ruby-hello-world-test job")
immediateInteractionWithJenkins(fmt.Sprintf("%s/job/ruby-hello-world-test/build?delay=0sec", jenkinsUri), "POST", password, nil, 201)
j.startJob("ruby-hello-world-test")
verifyPodProvisioned := func() (bool, error) {
out, err := oc.Run("logs").Args("dc/jenkins").Output()
if err != nil {
Expand Down
Loading

0 comments on commit ca101d7

Please sign in to comment.