From d41acdaf6ab5ab91fb8374ce102e3f3dd8cee807 Mon Sep 17 00:00:00 2001 From: Jakub Čajka Date: Nov 27 2017 14:20:30 +0000 Subject: Fix tests Allocate tty fot the containers as we are not using only daemons for the builder image test --- diff --git a/1.8/test/import-with-vendor-app/s2i-build b/1.8/test/import-with-vendor-app/s2i-build index 5fe0561..8522f4d 100755 --- a/1.8/test/import-with-vendor-app/s2i-build +++ b/1.8/test/import-with-vendor-app/s2i-build @@ -1,2 +1,2 @@ #!/bin/bash -s2i build -e IMPORT_URL='github.com/cpuguy83/go-md2man' ${s2i_args} file://${test_dir}/${1}/app ${IMAGE_NAME} ${IMAGE_NAME}-testapp +s2i build -e IMPORT_URL='github.com/cpuguy83/go-md2man' ${s2i_args} file://./app ${IMAGE_NAME} ${IMAGE_NAME}-testapp diff --git a/1.8/test/import-without-vendor-app/s2i-build b/1.8/test/import-without-vendor-app/s2i-build index 5fe0561..8522f4d 100755 --- a/1.8/test/import-without-vendor-app/s2i-build +++ b/1.8/test/import-without-vendor-app/s2i-build @@ -1,2 +1,2 @@ #!/bin/bash -s2i build -e IMPORT_URL='github.com/cpuguy83/go-md2man' ${s2i_args} file://${test_dir}/${1}/app ${IMAGE_NAME} ${IMAGE_NAME}-testapp +s2i build -e IMPORT_URL='github.com/cpuguy83/go-md2man' ${s2i_args} file://./app ${IMAGE_NAME} ${IMAGE_NAME}-testapp diff --git a/1.8/test/run b/1.8/test/run index 8375fbf..ff222f4 100755 --- a/1.8/test/run +++ b/1.8/test/run @@ -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. # -IMAGE_NAME=${IMAGE_NAME:-sclorg/python-36-centos7-candidate} +export IMAGE_NAME=${IMAGE_NAME:-sclorg/python-36-centos7-candidate} declare -a TEST_APPS=({simple,import-with-vendor,import-without-vendor}-app) @@ -32,7 +32,9 @@ container_ip() { run_s2i_build() { info "Building the ${1} application image ..." - ${test_dir}/${1}/s2i-build + pushd ${test_dir}/${1} >/dev/null + ./s2i-build + popd } prepare() { @@ -43,7 +45,7 @@ prepare() { # TODO: S2I build require the application is a valid 'GIT' repository, we # should remove this restriction in the future when a file:// is used. info "Preparing to test ${1} ..." - pushd ${test_dir}/${1} >/dev/null + pushd ${test_dir}/${1}/app >/dev/null git init git config user.email "build@localhost" && git config user.name "builder" git add -A && git commit -m "Sample commit" @@ -51,7 +53,7 @@ prepare() { } run_test_application() { - docker run --user=100001 ${CONTAINER_ARGS} --rm --cidfile=${cid_file} ${IMAGE_NAME}-testapp + docker run -t --user=100001 ${CONTAINER_ARGS} --rm --cidfile=${cid_file} ${IMAGE_NAME}-testapp } cleanup_app() { @@ -109,7 +111,7 @@ test_scl_usage() { local cid_file="$3" info "Testing the image SCL enable" - out=$(docker run --rm ${IMAGE_NAME} /bin/bash -c "${run_cmd}" 2>&1) + out=$(docker run -t --rm ${IMAGE_NAME} /bin/bash -c "${run_cmd}" 2>&1) if ! echo "${out}" | grep -q "${expected}"; then echo "ERROR[/bin/bash -c "${run_cmd}"] Expected '${expected}', got '${out}'" return 1 @@ -142,7 +144,7 @@ test_application() { # Since we built the candidate image locally, we don't want S2I attempt to pull # it from Docker hub -s2i_args="--force-pull=false" +export s2i_args="--force-pull=false" # Verify the 'usage' script is working properly when running the base image with 's2i usage ...' test_s2i_usage diff --git a/1.8/test/simple-app/s2i-build b/1.8/test/simple-app/s2i-build index 9e70970..b31af36 100755 --- a/1.8/test/simple-app/s2i-build +++ b/1.8/test/simple-app/s2i-build @@ -1,2 +1,2 @@ #!/bin/bash -s2i build ${s2i_args} file://${test_dir}/${1}/app ${IMAGE_NAME} ${IMAGE_NAME}-testapp +s2i build file://./app ${IMAGE_NAME} ${IMAGE_NAME}-testapp