Skip to content

Commit

Permalink
added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
raffaelespazzoli committed Jun 13, 2018
1 parent 44f9397 commit 5b3161d
Show file tree
Hide file tree
Showing 8 changed files with 218 additions and 48 deletions.
24 changes: 24 additions & 0 deletions cucumber-selenium-grid/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,30 @@ pipeline {
}
}
}

stage ('Run integration tests') {
steps {
sh ${CONTEXT_DIR}/integration-tests
sh "/bin/bash -c 'npm install'"
sh "/bin/bash -c 'node ./node_modules/protractor/bin/protractor protractor-conf.js'"
// script {
// archive (includes: 'pkg/*.gem')
// publishHTML (target: [
// allowMissing: false,
// alwaysLinkToLastBuild: false,
// keepAll: true,
// reportDir: 'coverage',
// reportFiles: 'index.html',
// reportName: "RCov Report"
// ])
// }
}

}




stage('Promote from Stage to Prod') {
steps {
script {
Expand Down
20 changes: 19 additions & 1 deletion cucumber-selenium-grid/README1.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,22 @@ oc new-project selenium
oc new-app registry.access.redhat.com/rhoar-nodejs/nodejs-8~https://github.com/raffaelespazzoli/todomvc --context-dir examples/angularjs --name todomvc

oc new-build --strategy=docker --name=jenkins-slave-nodejs8
oc start-build -F jenkins-slave-protractor --from-dir=.
oc start-build -F jenkins-slave-protractor --from-dir=.


setup
oc process -f applier/projects/projects.yml | oc apply -f -
oc process openshift//jenkins-ephemeral | oc apply -f- -n todomvc-build
oc new-build --strategy docker --name jenkins-slave-nodejs8 --context-dir cucumber-selenium-grid/nodejs-slave https://github.com/raffaelespazzoli/container-pipelines#selenium -n todomvc-build
oc process -f applier/templates/deployment.yml --param-file=applier/params/deployment-dev | oc apply -f-
oc process -f applier/templates/deployment.yml --param-file=applier/params/deployment-stage | oc apply -f-
oc process -f applier/templates/deployment.yml --param-file=applier/params/deployment-prod | oc apply -f-
oc process -f applier/templates/build.yml --param-file applier/params/build-dev | oc apply -f-
oc adm policy add-scc-to-user anyuid -z zalenium -n todomvc-stage
oc process -f applier/templates/selenium-grid.yaml NAMESPACE=todomvc-stage | oc apply -f -
oc adm policy add-cluster-role-to-user zalenium-role -z zalenium -n todomvc-stage

oc delete project todomvc-build
oc delete project todomvc-dev
oc delete project todomvc-stage
oc delete project todomvc-prod
2 changes: 1 addition & 1 deletion cucumber-selenium-grid/applier/params/build-dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
APPLICATION_NAME=todo-mvc
APPLICATION_NAME=todomvc
NAMESPACE=todomvc-build
SOURCE_REPOSITORY_URL=https://github.com/raffaelespazzoli/container-pipelines
SOURCE_REPOSITORY_REF=selenium
Expand Down
8 changes: 3 additions & 5 deletions cucumber-selenium-grid/applier/params/deployment-dev
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
APPLICATION_NAME=spring-rest
NAMESPACE=basic-spring-boot-dev
SA_NAMESPACE=basic-spring-boot-build
READINESS_RESPONSE=status.:.UP
READINESS_PATH=/health
APPLICATION_NAME=todomvc
NAMESPACE=todomvc-dev
SA_NAMESPACE=todomvc-build
8 changes: 3 additions & 5 deletions cucumber-selenium-grid/applier/params/deployment-prod
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
APPLICATION_NAME=spring-rest
NAMESPACE=basic-spring-boot-prod
SA_NAMESPACE=basic-spring-boot-build
READINESS_RESPONSE=status.:.UP
READINESS_PATH=/health
APPLICATION_NAME=todomvc
NAMESPACE=todomvc-prod
SA_NAMESPACE=todomvc-build
8 changes: 3 additions & 5 deletions cucumber-selenium-grid/applier/params/deployment-stage
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
APPLICATION_NAME=spring-rest
NAMESPACE=basic-spring-boot-stage
APPLICATION_NAME=todomvc
NAMESPACE=todomvc-stage
SA_NAME=jenkins
SA_NAMESPACE=basic-spring-boot-build
READINESS_RESPONSE=status.:.UP
READINESS_PATH=/health
SA_NAMESPACE=todomvc-build
39 changes: 8 additions & 31 deletions cucumber-selenium-grid/applier/templates/deployment.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
apiVersion: v1
kind: Template
labels:
template: basic-spring-boot
template: basic-nodejs
metadata:
annotations:
description: Application template for JWS applications built using a Jenkins Pipeline
iconClass: icon-tomcat
tags: java,spring
description: Application template for nodejs built using a Jenkins Pipeline
iconClass: icon-nodejs
tags: javascript,nodejs
version: 1.2.0
name: basic-sprint-boot
name: basic-nodejs
objects:
- apiVersion: v1
kind: Service
Expand Down Expand Up @@ -67,28 +67,13 @@ objects:
name: ${APPLICATION_NAME}
spec:
containers:
- env:
- name: JWS_ADMIN_USERNAME
value: ${JWS_ADMIN_USERNAME}
- name: JWS_ADMIN_PASSWORD
value: ${JWS_ADMIN_PASSWORD}
image: ${APPLICATION_NAME}
- image: ${APPLICATION_NAME}
imagePullPolicy: Always
name: ${APPLICATION_NAME}
ports:
- containerPort: 8778
name: jolokia
protocol: TCP
- containerPort: 8080
name: http
protocol: TCP
readinessProbe:
exec:
command:
- /bin/bash
- -c
- curl -s 'http://localhost:8080${READINESS_PATH}'
|grep -iq '${READINESS_RESPONSE}'
terminationGracePeriodSeconds: 60
triggers:
- imageChangeParams:
Expand All @@ -106,7 +91,7 @@ objects:
metadata:
creationTimestamp: null
labels:
template: basic-tomcat-template
template: basic-nodejs
name: jenkins_edit
namespace: ${NAMESPACE}
roleRef:
Expand All @@ -121,7 +106,7 @@ parameters:
- description: The name for the application.
name: APPLICATION_NAME
required: true
value: jws-app
value: nodejs
- description: The namespace to deploy into
name: NAMESPACE
required: true
Expand All @@ -135,11 +120,3 @@ parameters:
- description: 'Custom hostname for http service route. Leave blank for default hostname,
e.g.: <application-name>-<project>.<default-domain-suffix>'
name: HOSTNAME_HTTP
- description: 'URI to check for app health'
name: READINESS_PATH
required: true
value: '/'
- description: 'String value expected back from readiness check'
name: READINESS_RESPONSE
required: true
value: 'Hello World!'
157 changes: 157 additions & 0 deletions cucumber-selenium-grid/applier/templates/selenium-grid.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
apiVersion: v1
kind: Template
labels:
template: zalenium
metadata:
annotations:
description: zalenium deployment
tags: selenium,selenium-grid,zalenium
name: zalenium
objects:
- apiVersion: v1
kind: ClusterRole
metadata:
name: zalenium-role
namespace: ${NAMESPACE}
rules:
- verbs: ['create','list','get','delete','exec']
resources: ['pods']
- verbs: ['list', 'create', 'delete', 'get']
resources: ['services']
- verbs: ['create', 'get']
resources: ['pod/exec']

- apiVersion: v1
kind: ServiceAccount
metadata:
name: zalenium
namespace: ${NAMESPACE}

- apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: zalenium-role-zalenium-binding
namespace: ${NAMESPACE}
roleRef:
kind: ClusterRole
name: zalenium-role
subjects:
kind: ServiceAccount
name: zalenium
namespace: ${NAMESPACE}

- apiVersion: v1
kind: Service
metadata:
labels:
app: zalenium
name: zalenium
namespace: ${NAMESPACE}
spec:
ports:
- name: zalenium
port: 4444
protocol: TCP
targetPort: 4444
selector:
app: zalenium
role: grid
type: ClusterIP
- apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: zalenium
namespace: ${NAMESPACE}
spec:
replicas: 1
template:
metadata:
labels:
app: zalenium
role: grid
spec:
# Added to test manually https://github.com/zalando/zalenium/issues/246
hostAliases:
- ip: "127.0.0.1"
hostnames:
- "foo.local"
- "bar.local"
containers:
- name: zalenium
image: dosel/zalenium:latest
args:
- start
- '--desiredContainers'
- '2'
- '--screenWidth'
- '1440'
- '--screenHeight'
- '810'
- '--seleniumImageName'
- 'elgalu/selenium'
- '--maxTestSessions'
- '4'
env:
- name: ZALENIUM_KUBERNETES_CPU_REQUEST
value: 250m
- name: ZALENIUM_KUBERNETES_CPU_LIMIT
value: 500m
- name: ZALENIUM_KUBERNETES_MEMORY_REQUEST
value: 500Mi
- name: ZALENIUM_KUBERNETES_MEMORY_LIMIT
value: 1Gi
- name: OVERRIDE_WAIT_TIME
value: 5m
resources:
requests:
cpu: 250m
memory: 400Mi
ports:
- containerPort: 4444
protocol: TCP
volumeMounts:
- name: zalenium-data
mountPath: /home/seluser/videos
- name: zalenium-mounted
mountPath: /tmp/mounted
volumes:
- name: zalenium-data
persistentVolumeClaim:
claimName: zalenium-data
- name: zalenium-mounted
persistentVolumeClaim:
claimName: zalenium-mounted
serviceAccountName: zalenium
serviceAccount: zalenium
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: zalenium-mounted
namespace: ${NAMESPACE}
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 2Gi
storageClassName: local-pod
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: zalenium-data
namespace: ${NAMESPACE}
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
parameters:
- description: The namespace to deploy into
name: NAMESPACE
required: true





0 comments on commit 5b3161d

Please sign in to comment.