From e9b893fd97f504bce522ec9b33c00188a29200de Mon Sep 17 00:00:00 2001 From: Anush Shetty Date: Mon, 5 Feb 2018 07:55:27 -0500 Subject: [PATCH] Fix OpenShift s2i tests: Minor changes to get the s2i tests working. --- docs/examples/s2i/configs/application.yaml | 14 +++++++------- docs/examples/s2i/configs/redis.yaml | 6 +++--- docs/examples/s2i/requirements.txt | 2 ++ tests/e2e/e2e.go | 2 +- tests/e2e/e2e_os_test.go | 17 +++++++++++++---- 5 files changed, 26 insertions(+), 15 deletions(-) create mode 100644 docs/examples/s2i/requirements.txt diff --git a/docs/examples/s2i/configs/application.yaml b/docs/examples/s2i/configs/application.yaml index 501a0e1da..01782fcfa 100644 --- a/docs/examples/s2i/configs/application.yaml +++ b/docs/examples/s2i/configs/application.yaml @@ -1,8 +1,8 @@ -name: ticker -controller: deploymentconfig +name: s2i-img -containers: -- image: "" +deploymentConfigs: +- containers: + - image: s2i-img env: - name: REDIS_HOST value: redis @@ -11,10 +11,10 @@ triggers: - imageChangeParams: automatic: true containerNames: - - ticker + - s2i-img from: kind: ImageStreamTag - name: ticker:latest + name: s2i-img:latest type: ImageChange services: @@ -24,4 +24,4 @@ services: routes: - to: kind: Service - name: ticker + name: s2i-img diff --git a/docs/examples/s2i/configs/redis.yaml b/docs/examples/s2i/configs/redis.yaml index d510bf1bb..a94ff3786 100644 --- a/docs/examples/s2i/configs/redis.yaml +++ b/docs/examples/s2i/configs/redis.yaml @@ -1,7 +1,7 @@ name: redis -controller: deploymentconfig -containers: -- image: redis +deploymentConfigs: +- containers: + - image: redis services: - portMappings: - "6379" diff --git a/docs/examples/s2i/requirements.txt b/docs/examples/s2i/requirements.txt new file mode 100644 index 000000000..1a5dc97b1 --- /dev/null +++ b/docs/examples/s2i/requirements.txt @@ -0,0 +1,2 @@ +flask +redis diff --git a/tests/e2e/e2e.go b/tests/e2e/e2e.go index 186d365fb..dfe674e2d 100644 --- a/tests/e2e/e2e.go +++ b/tests/e2e/e2e.go @@ -255,5 +255,5 @@ type testData struct { PodStarted []string NodePortServices []ServicePort Type string - BaseImage string + OSCmdOptions } diff --git a/tests/e2e/e2e_os_test.go b/tests/e2e/e2e_os_test.go index 473c2cad7..ae760f705 100644 --- a/tests/e2e/e2e_os_test.go +++ b/tests/e2e/e2e_os_test.go @@ -24,8 +24,9 @@ func waitForBuildComplete(namespace string, buildName string) error { }) } -func runKedgeS2i(imageName string, baseImage string) error { - s2iCmd := BinaryLocation + " build --s2i --image " + imageName + " -b " + baseImage +func runKedgeS2i(nameSpace string, baseImage string, contextDir string) error { + s2iCmd := BinaryLocation + " build --s2i --image " + nameSpace + "-img -b " + baseImage + + " -c " + contextDir + " -n " + nameSpace _, err := runCmd(s2iCmd) if err != nil { return errors.Wrap(err, "error build s2i image") @@ -33,6 +34,11 @@ func runKedgeS2i(imageName string, baseImage string) error { return nil } +type OSCmdOptions struct { + BaseImage string + ContextDir string +} + // TODO: Use OpenShift client-go API instead of go-template func Test_os_Integration(t *testing.T) { clientset, err := createClient() @@ -71,7 +77,10 @@ func Test_os_Integration(t *testing.T) { }, PodStarted: []string{"redis"}, Type: "s2i", - BaseImage: "centos/python-35-centos7:3.5", + OSCmdOptions: OSCmdOptions{ + BaseImage: "centos/python-35-centos7:3.5", + ContextDir: ProjectPath + TestPath + "s2i", + }, }, } @@ -94,7 +103,7 @@ func Test_os_Integration(t *testing.T) { defer deleteNamespace(t, clientset, test.Namespace) if test.Type == "s2i" { - err := runKedgeS2i(test.Namespace, test.BaseImage) + err := runKedgeS2i(test.Namespace, test.OSCmdOptions.BaseImage, test.OSCmdOptions.ContextDir) if err != nil { t.Fatalf("error running kedge s2i: %v", err) }