auto-sync: master commit 897c8e39fe1df6c7bb6418d2892ccbd118d723f8

\n\nUpstreamCommitID: 546dfadbf110928dd357a55674ae7beabff8bcee\nUpstreamCommitLink: 546dfadbf1\nUpstreamRepository: https://github.com/sclorg/s2i-python-container
This commit is contained in:
phracek 2020-05-20 09:17:29 +00:00
commit 3300dd8839
17 changed files with 330 additions and 14 deletions

View file

@ -6,7 +6,7 @@
# IMAGE_NAME specifies a name of the candidate image used for testing.
# The image has to be available before this script is executed.
#
declare -a WEB_APPS=({standalone,setup,setup-requirements,django,numpy,app-home,npm-virtualenv-uwsgi,locale,mod-wsgi,pipenv}-test-app)
declare -a WEB_APPS=({standalone,setup,setup-requirements,django,numpy,app-home,npm-virtualenv-uwsgi,locale,mod-wsgi,pipenv,pipenv-and-micropipenv-should-fail,micropipenv,micropipenv-requirements}-test-app)
# TODO: Make command compatible for Mac users
test_dir="$(readlink -zf $(dirname "${BASH_SOURCE[0]}"))"
@ -36,6 +36,7 @@ container_exists() {
image_exists $(cat $cid_file)
}
container_ip() {
docker inspect --format="{{ .NetworkSettings.IPAddress }}" $(cat $cid_file)
}
@ -82,11 +83,18 @@ cleanup() {
}
check_result() {
# positive test & non-zero exit status = ERROR
# negative test & zero exit status = ERROR
local result="$1"
if [[ "$result" != "0" ]]; then
info "TEST FAILED (${result})"
local test=${2:-positive} # if not defined, we expect possitive test type (zero exit code)
if [[ "$type" == "positive" && "$result" != "0" ]]; then
info "TEST FAILED (${type}), EXPECTED:0 GOT:${result}"
cleanup
exit $result
elif [[ "$type" == "negative" && "$result" == "0" ]]; then
info "TEST FAILED (${type}), EXPECTED: non-zero GOT:${result}"
cleanup
exit 1
fi
}
@ -189,10 +197,20 @@ check_result $?
test_docker_run_usage
check_result $?
for app in ${WEB_APPS[@]}; do
# For debugging purposes, this script can be run with one or more arguments
# those arguments list is a sub-set of values in the WEB_APPS array defined above
# Example: ./run app-home-test-app pipenv-test-app
for app in ${@:-${WEB_APPS[@]}}; do
prepare ${app}
run_s2i_build ${app}
check_result $?
RESULT=$?
if [[ "$app" == *"-should-fail-"* ]]; then
# Tests with '-should-fail-' in their name should fail during a build, expecting non-zero exit status
check_result $RESULT "negative"
continue
else
check_result $RESULT
fi
# test application with default user
test_application