Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Integration tests to be run in a remote cluster #200

Closed
wants to merge 2 commits into from
Closed
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
2 changes: 1 addition & 1 deletion common
35 changes: 0 additions & 35 deletions test/run-openshift

This file was deleted.

1 change: 1 addition & 0 deletions test/run-openshift
35 changes: 35 additions & 0 deletions test/run-openshift-local-cluster
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
#
# Test the NodeJS image in OpenShift.
#
# IMAGE_NAME specifies a name of the candidate image used for testing.
# The image has to be available before this script is executed.
#

THISDIR=$(dirname ${BASH_SOURCE[0]})

source "${THISDIR}/test-lib.sh"
source "${THISDIR}/test-lib-openshift.sh"

# change the branch to a different value if a new change in the example
# app needs to be tested
BRANCH_TO_TEST=master

set -eo nounset

test -n "${IMAGE_NAME-}" || false 'make sure $IMAGE_NAME is defined'
test -n "${VERSION-}" || false 'make sure $VERSION is defined'

ct_os_cluster_up
# TODO: We can make the tests work against examples inside the same PR
ct_os_test_s2i_app "${IMAGE_NAME}" "https://github.com/sclorg/s2i-nodejs-container.git" test/test-app "This is a node.js echo service"
ct_os_test_s2i_app "${IMAGE_NAME}" "https://github.com/sclorg/nodejs-ex.git" . "Welcome to your Node.js application on OpenShift"

for template in nodejs.json nodejs-mongodb.json nodejs-mongodb-persistent.json ; do

ct_os_test_template_app ${IMAGE_NAME} \
https://raw.githubusercontent.com/sclorg/nodejs-ex/${BRANCH_TO_TEST}/openshift/templates/${template} \
nodejs \
"Welcome to your Node.js application on OpenShift" \
8080 http 200 "-p SOURCE_REPOSITORY_REF=${BRANCH_TO_TEST} -p SOURCE_REPOSITORY_URL=https://github.com/sclorg/nodejs-ex.git -p NODEJS_VERSION=${VERSION} -p NAME=nodejs-testing"
done
30 changes: 30 additions & 0 deletions test/run-openshift-remote-cluster
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
#
# Test the Node.js S2I image in OpenShift (remote cluster)
#
# IMAGE_NAME specifies a name of the candidate image used for testing.
# The image has to be available before this script is executed.
# VERSION specifies the major version of the Node.js runtime in format of X.Y
# OS specifies RHEL version (e.g. OS=rhel7)
#

THISDIR=$(dirname ${BASH_SOURCE[0]})

source ${THISDIR}/test-lib-nodejs.sh

set -eo nounset

trap ct_os_cleanup EXIT SIGINT

ct_os_check_compulsory_vars

oc status || false "It looks like oc is not properly logged in."

export CT_SKIP_NEW_PROJECT=true
export CT_SKIP_UPLOAD_IMAGE=true
export CT_NAMESPACE=openshift

test_nodejs_integration nodejs ${VERSION} "${IMAGE_NAME}"

OS_TESTSUITE_RESULT=0

26 changes: 26 additions & 0 deletions test/test-lib-nodejs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
#
# Functions for tests for the Node.js image in OpenShift.
#
# IMAGE_NAME specifies a name of the candidate image used for testing.
# The image has to be available before this script is executed.
#

THISDIR=$(dirname ${BASH_SOURCE[0]})

source ${THISDIR}/test-lib.sh
source ${THISDIR}/test-lib-openshift.sh

function test_nodejs_integration() {
local image_name=$1
local version=$2
local import_image=$3
VERSION=$version ct_os_test_s2i_app "${image_name}" \
"https://github.com/sclorg/s2i-nodejs-container.git" \
test/test-app \
".*" \
8080 http 200 "" \
"${import_image}"
}

# vim: set tabstop=2:shiftwidth=2:expandtab: