Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Fix OpenShift s2i tests: #584

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions docs/examples/s2i/configs/application.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: ticker
controller: deploymentconfig
name: s2i-img

containers:
- image: ""
deploymentConfigs:
- containers:
- image: s2i-img
env:
- name: REDIS_HOST
value: redis
Expand All @@ -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:
Expand All @@ -24,4 +24,4 @@ services:
routes:
- to:
kind: Service
name: ticker
name: s2i-img
6 changes: 3 additions & 3 deletions docs/examples/s2i/configs/redis.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: redis
controller: deploymentconfig
containers:
- image: redis
deploymentConfigs:
- containers:
- image: redis
services:
- portMappings:
- "6379"
2 changes: 2 additions & 0 deletions docs/examples/s2i/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
flask
redis
2 changes: 1 addition & 1 deletion tests/e2e/e2e.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,5 +255,5 @@ type testData struct {
PodStarted []string
NodePortServices []ServicePort
Type string
BaseImage string
OSCmdOptions
}
17 changes: 13 additions & 4 deletions tests/e2e/e2e_os_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,21 @@ 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 +
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be,

s2iCmd := BinaryLocation + " build --s2i --image " + baseImage +" -c " + contextDir + " -n " + nameSpace

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bit confused here, tests works fine locally:

 $ make test-e2e-os 
TEST=os make test-e2e 
make[1]: Entering directory '/home/snarwade/go/src/github.com/kedgeproject/kedge'
./scripts/run_e2e.sh
======================================
| Running end-to-end cluster tests.  |
| Tests will be ran against a k8s    |
| cluster in separate namespaces     |
|                                    |
| Use command:                       |
| VERBOSE=yes make test-e2e-os       |
| for verbosity.                     |
======================================

ok  	github.com/kedgeproject/kedge/tests/e2e	246.458s
make[1]: Leaving directory '/home/snarwade/go/src/github.com/kedgeproject/kedge'

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@surajnarwade the --image is for the name of the image to be generated. --baseimage is for baseimage.

" -c " + contextDir + " -n " + nameSpace
_, err := runCmd(s2iCmd)
if err != nil {
return errors.Wrap(err, "error build s2i image")
}
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()
Expand Down Expand Up @@ -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",
},
},
}

Expand All @@ -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)
}
Expand Down