Skip to content

Commit

Permalink
SRVKP-6765 Add tests for ecosystem s2i test (#459)
Browse files Browse the repository at this point in the history
  • Loading branch information
jayesh-garg authored Dec 19, 2024
1 parent d1260fa commit bc498bc
Show file tree
Hide file tree
Showing 11 changed files with 318 additions and 6 deletions.
7 changes: 7 additions & 0 deletions pkg/triggers/triggers.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ func ExposeEventListner(c *clients.Clients, elname, namespace string) string {
return GetRoute(elname, namespace)
}

func ExposeDeploymentConfig(c *clients.Clients, elname, port, namespace string) string {
cmd.MustSucceed("oc", "expose", "dc/"+elname, "-n", namespace, "--target-port="+port)
cmd.MustSucceed("oc", "expose", "svc", elname, "-n", namespace, "--target-port="+port)

return elname
}

func ExposeEventListenerForTLS(c *clients.Clients, elname, namespace string) string {
svcName, portName := getServiceNameAndPort(c, elname, namespace)
domain := getDomain()
Expand Down
166 changes: 166 additions & 0 deletions specs/ecosystem/ecosystem-s2i.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
PIPELINES-33
# Verify Ecosystem E2E spec

Pre condition:
* Validate Operator should be installed

## S2I nodejs pipelinerun: PIPELINES-33-TC01
Tags: e2e, ecosystem, non-admin, s2i, sanity
Component: Pipelines
Level: Integration
Type: Functional
Importance: Critical

Steps:
* Verify ServiceAccount "pipeline" exist
* Create
|S.NO|resource_dir |
|----|-------------------------------------------------------------|
|1 |testdata/ecosystem/pipelines/nodejs-ex-git.yaml |
|2 |testdata/pvc/pvc.yaml |
|3 |testdata/ecosystem/deploymentconfigs/nodejs-ex-git.yaml |
|4 |testdata/ecosystem/imagestreams/nodejs-ex-git.yaml |
|5 |testdata/ecosystem/pipelineruns/nodejs-ex-git.yaml |
* Verify pipelinerun
|S.NO|pipeline_run_name|status |check_lable_propagation|
|----|-----------------|-----------|-----------------------|
|1 |nodejs-ex-git-pr |successful |no |
* Expose Deployment config "nodejs-ex-git" on port "3000"
* Get route url of the route "nodejs-ex-git"
* Validate that route URL contains "See Also"

## S2I dotnet pipelinerun: PIPELINES-33-TC02
Tags: e2e, ecosystem, non-admin, s2i, skip_linux/ppc64le
Component: Pipelines
Level: Integration
Type: Functional
Importance: Critical

Steps:
* Verify ServiceAccount "pipeline" exist
* Create
|S.NO|resource_dir |
|----|------------------------------------------------------|
|1 |testdata/ecosystem/pipelines/s2i-dotnet.yaml |
|2 |testdata/pvc/pvc.yaml |
* Get tags of the imagestream "dotnet" from namespace "openshift" and store to variable "dotnet-tags"
* Start and verify dotnet pipeline "s2i-dotnet-pipeline" with values stored in variable "dotnet-tags" with workspace "name=source,claimName=shared-pvc"

## S2I golang pipelinerun: PIPELINES-33-TC03
Tags: e2e, ecosystem, non-admin, s2i
Component: Pipelines
Level: Integration
Type: Functional
Importance: Critical

Steps:
* Verify ServiceAccount "pipeline" exist
* Create
|S.NO|resource_dir |
|----|------------------------------------------------------|
|1 |testdata/ecosystem/pipelines/s2i-go.yaml |
|2 |testdata/pvc/pvc.yaml |
* Get tags of the imagestream "golang" from namespace "openshift" and store to variable "golang-tags"
* Start and verify pipeline "s2i-go-pipeline" with param "VERSION" with values stored in variable "golang-tags" with workspace "name=source,claimName=shared-pvc"

## S2I java pipelinerun: PIPELINES-33-TC04
Tags: e2e, ecosystem, non-admin, s2i, sanity
Component: Pipelines
Level: Integration
Type: Functional
Importance: Critical

Steps:
* Verify ServiceAccount "pipeline" exist
* Create
|S.NO|resource_dir |
|----|------------------------------------------------------|
|1 |testdata/ecosystem/pipelines/s2i-java.yaml |
|2 |testdata/pvc/pvc.yaml |
* Get tags of the imagestream "java" from namespace "openshift" and store to variable "java-tags"
* Start and verify pipeline "s2i-java-pipeline" with param "VERSION" with values stored in variable "java-tags" with workspace "name=source,claimName=shared-pvc"

## S2I nodejs pipelinerun: PIPELINES-33-TC05
Tags: e2e, ecosystem, non-admin, s2i
Component: Pipelines
Level: Integration
Type: Functional
Importance: Critical

Steps:
* Verify ServiceAccount "pipeline" exist
* Create
|S.NO|resource_dir |
|----|------------------------------------------------------|
|1 |testdata/ecosystem/pipelines/s2i-nodejs.yaml |
|2 |testdata/pvc/pvc.yaml |
* Get tags of the imagestream "nodejs" from namespace "openshift" and store to variable "nodejs-tags"
* Start and verify pipeline "s2i-nodejs-pipeline" with param "VERSION" with values stored in variable "nodejs-tags" with workspace "name=source,claimName=shared-pvc"

## S2I perl pipelinerun: PIPELINES-33-TC06
Tags: e2e, ecosystem, non-admin, s2i
Component: Pipelines
Level: Integration
Type: Functional
Importance: Critical

Steps:
* Verify ServiceAccount "pipeline" exist
* Create
|S.NO|resource_dir |
|----|------------------------------------------------------|
|1 |testdata/ecosystem/pipelines/s2i-perl.yaml |
|2 |testdata/pvc/pvc.yaml |
* Get tags of the imagestream "perl" from namespace "openshift" and store to variable "perl-tags"
* Start and verify pipeline "s2i-perl-pipeline" with param "VERSION" with values stored in variable "perl-tags" with workspace "name=source,claimName=shared-pvc"

## S2I php pipelinerun: PIPELINES-33-TC07
Tags: e2e, ecosystem, non-admin, s2i
Component: Pipelines
Level: Integration
Type: Functional
Importance: Critical

Steps:
* Verify ServiceAccount "pipeline" exist
* Create
|S.NO|resource_dir |
|----|---------------------------------------------------|
|1 |testdata/ecosystem/pipelines/s2i-php.yaml |
|2 |testdata/pvc/pvc.yaml |
* Get tags of the imagestream "php" from namespace "openshift" and store to variable "php-tags"
* Start and verify pipeline "s2i-php-pipeline" with param "VERSION" with values stored in variable "php-tags" with workspace "name=source,claimName=shared-pvc"

## S2I python pipelinerun: PIPELINES-33-TC08
Tags: e2e, ecosystem, non-admin, s2i
Component: Pipelines
Level: Integration
Type: Functional
Importance: Critical

Steps:
* Verify ServiceAccount "pipeline" exist
* Create
|S.NO|resource_dir |
|----|------------------------------------------------------|
|1 |testdata/ecosystem/pipelines/s2i-python.yaml |
|2 |testdata/pvc/pvc.yaml |
* Get tags of the imagestream "python" from namespace "openshift" and store to variable "python-tags"
* Start and verify pipeline "s2i-python-pipeline" with param "VERSION" with values stored in variable "python-tags" with workspace "name=source,claimName=shared-pvc"

## S2I ruby pipelinerun: PIPELINES-33-TC09
Tags: e2e, ecosystem, non-admin, s2i
Component: Pipelines
Level: Integration
Type: Functional
Importance: Critical

Steps:
* Verify ServiceAccount "pipeline" exist
* Create
|S.NO|resource_dir |
|----|----------------------------------------------------|
|1 |testdata/ecosystem/pipelines/s2i-ruby.yaml |
|2 |testdata/pvc/pvc.yaml |
* Get tags of the imagestream "ruby" from namespace "openshift" and store to variable "ruby-tags"
* Start and verify pipeline "s2i-ruby-pipeline" with param "VERSION" with values stored in variable "ruby-tags" with workspace "name=source,claimName=shared-pvc"
4 changes: 2 additions & 2 deletions specs/triggers/tutorial.spec
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Steps:
|1 |build-deploy-ui-pipelinerun|successful|no |
* Get route url of the route "pipelines-vote-ui"
* Wait for pipelines-vote-ui deployment
* Validate route url for pipelines tutorial
* Validate that route URL contains "Cat 🐺 vs Dog 🐶"

## Run pipelines tutorial using triggers: PIPELINES-06-TC02
Tags: e2e, integration, triggers, non-admin, tutorial, sanity
Expand Down Expand Up @@ -72,4 +72,4 @@ Steps:
* Verify the latest pipelinerun for "successful" state
* Get route url of the route "pipelines-vote-ui"
* Wait for pipelines-vote-ui deployment
* Validate route url for pipelines tutorial
* Validate that route URL contains "Cat 🐺 vs Dog 🐶"
4 changes: 4 additions & 0 deletions steps/triggers/triggers.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ var _ = gauge.Step("Expose Event listener for TLS <elname>", func(elname string)
store.PutScenarioData("elname", elname)
})

var _ = gauge.Step("Expose Deployment config <elname> on port <port>", func(elname, port string) {
triggers.ExposeDeploymentConfig(store.Clients(), elname, port, store.Namespace())
})

var _ = gauge.Step("Mock post event with empty payload", func() {
gauge.GetScenarioStore()["response"] = triggers.MockPostEventWithEmptyPayload(store.GetScenarioData("route"))
})
Expand Down
5 changes: 2 additions & 3 deletions steps/utility/utility.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,12 @@ var _ = gauge.Step("Switch to project <projectName>", func(projectName string) {
gauge.GetScenarioStore()["namespace"] = projectName
})

var _ = gauge.Step("Validate route url for pipelines tutorial", func() {
expectedOutput := "Cat 🐺 vs Dog 🐶"
var _ = gauge.Step("Validate that route URL contains <expectedOutput>", func(expectedOutput string) {
routeUrl := store.GetScenarioData("routeurl")
output := cmd.MustSuccedIncreasedTimeout(30*time.Second, "lynx", routeUrl, "--dump").Stdout()
log.Println(output)
if !strings.Contains(output, expectedOutput) {
testsuit.T.Fail(fmt.Errorf("expected:\n%v,\ngot:\n%v", expectedOutput, output))
log.Println(output)
}
})

Expand Down
3 changes: 2 additions & 1 deletion tc_spec_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@
"PIPELINES-29": "specs/ecosystem/ecosystem.spec",
"PIPELINES-30": "specs/pac/pac-gitlab.spec",
"PIPELINES-31": "specs/pipelines/http-resolvers.spec",
"PIPELINES-32": "specs/ecosystem/ecosystem-multiarch.spec"
"PIPELINES-32": "specs/ecosystem/ecosystem-multiarch.spec",
"PIPELINES-33": "specs/ecosystem/ecosystem-s2i.spec"
}
31 changes: 31 additions & 0 deletions testdata/ecosystem/deploymentconfigs/nodejs-ex-git.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
kind: DeploymentConfig
apiVersion: apps.openshift.io/v1
metadata:
name: nodejs-ex-git
labels:
app: nodejs-ex-git
spec:
strategy:
type: Rolling
triggers:
- type: ImageChange
imageChangeParams:
automatic: true
containerNames:
- nodejs-ex-git
from:
kind: ImageStreamTag
name: 'nodejs-ex-git:latest'
- type: ConfigChange
replicas: 1
template:
metadata:
name: nodejs-ex-git
labels:
app: nodejs-ex-git
spec:
containers:
- name: nodejs-ex-git
ports:
- containerPort: 8080
protocol: TCP
4 changes: 4 additions & 0 deletions testdata/ecosystem/imagestreams/nodejs-ex-git.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
name: nodejs-ex-git
16 changes: 16 additions & 0 deletions testdata/ecosystem/pipelineruns/nodejs-ex-git.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
name: nodejs-ex-git-pr
spec:
pipelineRef:
name: nodejs-ex-git
workspaces:
- name: workspace
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
82 changes: 82 additions & 0 deletions testdata/ecosystem/pipelines/nodejs-ex-git.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: nodejs-ex-git
spec:
params:
- name: APP_NAME
default: nodejs-ex-git
- name: GIT_REPO
default: 'https://github.com/digitalocean/sample-nodejs.git'
- name: GIT_REVISION
default: master
- name: IMAGE_NAME
default: "image-registry.openshift-image-registry.svc:5000/$(context.pipelineRun.namespace)/nodejs-ex-git"
- name: PATH_CONTEXT
default: .
- name: VERSION
default: latest
tasks:
- name: fetch-repository
params:
- name: URL
value: $(params.GIT_REPO)
- name: revision
value: $(params.GIT_REVISION)
- name: subdirectory
value: ''
- name: deleteExisting
value: 'true'
taskRef:
resolver: cluster
params:
- name: kind
value: task
- name: name
value: git-clone
- name: namespace
value: openshift-pipelines
workspaces:
- name: output
workspace: workspace
- name: build
params:
- name: IMAGE
value: $(params.IMAGE_NAME)
- name: TLSVERIFY
value: 'false'
- name: PATH_CONTEXT
value: $(params.PATH_CONTEXT)
- name: VERSION
value: $(params.VERSION)
runAfter:
- fetch-repository
taskRef:
resolver: cluster
params:
- name: kind
value: task
- name: name
value: s2i-nodejs
- name: namespace
value: openshift-pipelines
workspaces:
- name: source
workspace: workspace
- name: deploy
params:
- name: SCRIPT
value: oc rollout status dc/$(params.APP_NAME)
runAfter:
- build
taskRef:
resolver: cluster
params:
- name: kind
value: task
- name: name
value: openshift-client
- name: namespace
value: openshift-pipelines
workspaces:
- name: workspace
2 changes: 2 additions & 0 deletions testdata/ecosystem/pipelines/s2i-php.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ spec:
params:
- name: URL
value: https://github.com/sclorg/s2i-php-container
- name: REVISION
value: master
- name: SUBDIRECTORY
value: s2i-php-$(params.VERSION)
- name: DELETE_EXISTING
Expand Down

0 comments on commit bc498bc

Please sign in to comment.