diff options
author | Luke Meyer <lmeyer@redhat.com> | 2017-04-04 12:05:20 -0400 |
---|---|---|
committer | Luke Meyer <lmeyer@redhat.com> | 2017-04-25 12:17:38 -0400 |
commit | e5f14b515b07bcfa2079c3e68c35fee3e97970c7 (patch) | |
tree | 2f3cd2749ead0f19659b46d28f03114a58f803b3 /test/integration/run-tests.sh | |
parent | ce4c2f0cc0b4766eff28f5fa91eb353301ad9c91 (diff) | |
download | openshift-e5f14b515b07bcfa2079c3e68c35fee3e97970c7.tar.gz openshift-e5f14b515b07bcfa2079c3e68c35fee3e97970c7.tar.bz2 openshift-e5f14b515b07bcfa2079c3e68c35fee3e97970c7.tar.xz openshift-e5f14b515b07bcfa2079c3e68c35fee3e97970c7.zip |
integration tests: add CI scripts
Add some scripts that can be run from Jenkins to build/push test images
and to run the tests.
Updated README to expand on running tests.
Diffstat (limited to 'test/integration/run-tests.sh')
-rwxr-xr-x | test/integration/run-tests.sh | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/test/integration/run-tests.sh b/test/integration/run-tests.sh new file mode 100755 index 000000000..680b64602 --- /dev/null +++ b/test/integration/run-tests.sh @@ -0,0 +1,80 @@ +#!/bin/bash + +# This script runs the golang integration tests in the directories underneath. +# It should be run from the same directory it is in, or in a directory above. +# Specify the same image prefix used (if any) with build-images.sh +# +# Example: +# ./run-tests.sh --prefix=docker.io/openshift/ansible-integration- --parallel=16 + +set -o errexit +set -o nounset +set -o pipefail + +source_root=$(dirname "${0}") + +prefix="${PREFIX:-openshift-ansible-integration-}" +gotest_options="${GOTEST_OPTIONS:--v}" +push=false +verbose=false +help=false + +for args in "$@" +do + case $args in + --prefix=*) + prefix="${args#*=}" + ;; + --parallel=*) + gotest_options="${gotest_options} -parallel ${args#*=}" + ;; + --verbose) + verbose=true + ;; + --help) + help=true + ;; + esac +done + +if [ "$help" = true ]; then + echo "Runs the openshift-ansible integration tests." + echo + echo "Options: " + echo " --prefix=PREFIX" + echo " The prefix to use for the image names." + echo " default: openshift-ansible-integration-" + echo + echo " --parallel=NUMBER" + echo " Number of tests to run in parallel." + echo " default: GOMAXPROCS (typically, number of processors)" + echo + echo " --verbose" + echo " Enables printing of the commands as they run." + echo + echo " --help" + echo " Prints this help message" + echo + exit 0 +fi + + + +if ! [ -d $source_root/../../.tox/integration ]; then + # have tox create a consistent virtualenv + pushd $source_root/../..; tox -e integration; popd +fi +# use the virtualenv from tox +set +o nounset; source $source_root/../../.tox/integration/bin/activate; set -o nounset + +if [ "$verbose" = true ]; then + set -x +fi + +# Run the tests. NOTE: "go test" requires a relative path for this purpose. +# The PWD trick below will only work if cwd is in/above where this script lives. +retval=0 +IMAGE_PREFIX="${prefix}" env -u GOPATH \ + go test ./${source_root#$PWD}/... ${gotest_options} + + |