Browse code

Add extended test for proxy

Michal Fojtik authored on 2015/11/18 23:33:31
Showing 2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,43 @@
0
+package builds
1
+
2
+import (
3
+	g "github.com/onsi/ginkgo"
4
+	o "github.com/onsi/gomega"
5
+
6
+	buildapi "github.com/openshift/origin/pkg/build/api"
7
+	exutil "github.com/openshift/origin/test/extended/util"
8
+)
9
+
10
+var _ = g.Describe("builds: parallel: s2i build with proxy", func() {
11
+	defer g.GinkgoRecover()
12
+	var (
13
+		buildFixture = exutil.FixturePath("..", "extended", "fixtures", "test-build-proxy.json")
14
+		oc           = exutil.NewCLI("build-proxy", exutil.KubeConfigPath())
15
+	)
16
+
17
+	g.JustBeforeEach(func() {
18
+		g.By("waiting for builder service account")
19
+		err := exutil.WaitForBuilderAccount(oc.KubeREST().ServiceAccounts(oc.Namespace()))
20
+		o.Expect(err).NotTo(o.HaveOccurred())
21
+		oc.Run("create").Args("-f", buildFixture).Execute()
22
+	})
23
+
24
+	g.Describe("start build with broken proxy", func() {
25
+		g.It("should start a build and wait for the build to to fail", func() {
26
+			g.By("starting the build with --wait and --follow flags")
27
+			out, err := oc.Run("start-build").Args("sample-build", "--follow", "--wait").Output()
28
+			o.Expect(err).To(o.HaveOccurred())
29
+			g.By("verifying the build sample-app-1 output")
30
+			// The git ls-remote check should exit the build when the remote
31
+			// repository is not accessible. It should never get to the clone.
32
+			o.Expect(out).NotTo(o.ContainSubstring("clone"))
33
+			o.Expect(out).To(o.ContainSubstring(`unable to access 'https://github.com/openshift/ruby-hello-world.git/': Failed connect to 127.0.0.1:3128`))
34
+			g.By("verifying the build sample-build-1 status")
35
+			build, err := oc.REST().Builds(oc.Namespace()).Get("sample-build-1")
36
+			o.Expect(err).NotTo(o.HaveOccurred())
37
+			o.Expect(build.Status.Phase).Should(o.BeEquivalentTo(buildapi.BuildPhaseFailed))
38
+		})
39
+
40
+	})
41
+
42
+})
0 43
new file mode 100644
... ...
@@ -0,0 +1,60 @@
0
+{
1
+  "kind": "List",
2
+  "apiVersion": "v1",
3
+  "metadata": {},
4
+  "items": [
5
+    {
6
+      "kind": "ImageStream",
7
+      "apiVersion": "v1",
8
+      "metadata": {
9
+        "name": "origin-ruby-sample",
10
+        "creationTimestamp": null
11
+      },
12
+      "spec": {},
13
+      "status": {
14
+        "dockerImageRepository": ""
15
+      }
16
+    },
17
+    {
18
+      "kind": "BuildConfig",
19
+      "apiVersion": "v1",
20
+      "metadata": {
21
+        "name": "sample-build",
22
+        "creationTimestamp": null
23
+      },
24
+      "spec": {
25
+        "triggers": [
26
+          {
27
+            "type": "imageChange",
28
+            "imageChange": {}
29
+          }
30
+        ],
31
+        "source": {
32
+          "type": "Git",
33
+          "git": {
34
+            "uri": "https://github.com/openshift/ruby-hello-world.git",
35
+            "httpProxy": "127.0.0.1:3128",
36
+            "httpsProxy": "127.0.0.1:3128"
37
+          }
38
+        },
39
+        "strategy": {
40
+          "type": "Source",
41
+          "sourceStrategy": {
42
+            "env": [
43
+              { "name": "HTTPS_PROXY", "value": "127.0.0.1:3128" },
44
+              { "name": "HTTP_PROXY", "value": "127.0.0.1:3128" }
45
+            ],
46
+            "from": {
47
+              "kind": "DockerImage",
48
+              "name": "openshift/ruby-20-centos7"
49
+            }
50
+          }
51
+        },
52
+        "resources": {}
53
+      },
54
+      "status": {
55
+        "lastVersion": 0
56
+      }
57
+    }
58
+  ]
59
+}