#!/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" source "${THISDIR}/test-lib-nodejs.sh" # change the branch to a different value if a new change in the example # app needs to be tested BRANCH_TO_TEST=master test_dir="$(readlink -f $(dirname ${BASH_SOURCE[0]}))" set -eo nounset trap ct_os_cleanup EXIT SIGINT test_latest_imagestreams() { local result=1 # Switch to root directory of a container pushd "${test_dir}/.." >/dev/null || return 1 ct_check_latest_imagestreams result=$? popd >/dev/null || return 1 return $result } ct_os_check_compulsory_vars ct_os_enable_print_logs 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 # Check the imagestream test_nodejs_imagestream # check if latest imagestream version is correct test_latest_imagestreams ct_os_cluster_down # vim: set tabstop=2:shiftwidth=2:expandtab: