Skip to content

Commit

Permalink
Merge pull request #499 from sclorg/fixes_openshift_4
Browse files Browse the repository at this point in the history
Fixes OpenShift 4 test for postgresql-container
  • Loading branch information
phracek authored Mar 7, 2023
2 parents fb29af4 + 29f518a commit bc215c8
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 10 deletions.
1 change: 1 addition & 0 deletions test/run-openshift-remote-cluster
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ source "${THISDIR}/test-lib-remote-openshift.sh"
TEST_LIST="\
test_postgresql_integration
test_postgresql_imagestream
run_latest_imagestreams_test
"

trap ct_os_cleanup EXIT SIGINT
Expand Down
42 changes: 32 additions & 10 deletions test/test-lib-postgresql.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,19 @@ source "${THISDIR}"/test-lib-remote-openshift.sh

function test_postgresql_integration() {
local service_name=postgresql
ct_os_template_exists postgresql-ephemeral && t=postgresql-ephemeral || t=postgresql-persistent
ct_os_test_template_app_func "${IMAGE_NAME}" \
"${t}" \
"${service_name}" \
"ct_os_check_cmd_internal '<SAME_IMAGE>' '${service_name}-testing' 'PGPASSWORD=testp pg_isready -t 15 -h <IP> -U testu -d testdb' 'accepting connections' 120" \
"-p POSTGRESQL_VERSION=${VERSION} \
-p DATABASE_SERVICE_NAME="${service_name}-testing" \
-p POSTGRESQL_USER=testu \
-p POSTGRESQL_PASSWORD=testp \
-p POSTGRESQL_DATABASE=testdb"
TEMPLATES="postgresql-ephemeral-template.json
postgresql-persistent-template.json"
for template in $TEMPLATES; do
ct_os_test_template_app_func "${IMAGE_NAME}" \
"${THISDIR}/examples/${template}" \
"${service_name}" \
"ct_os_check_cmd_internal '<SAME_IMAGE>' '${service_name}-testing' 'PGPASSWORD=testp pg_isready -t 15 -h <IP> -U testu -d testdb' 'accepting connections' 120" \
"-p POSTGRESQL_VERSION=${VERSION} \
-p DATABASE_SERVICE_NAME="${service_name}-testing" \
-p POSTGRESQL_USER=testu \
-p POSTGRESQL_PASSWORD=testp \
-p POSTGRESQL_DATABASE=testdb"
done
}

# Check the imagestream
Expand All @@ -34,7 +37,26 @@ function test_postgresql_imagestream() {
elif [ "${OS}" == "rhel9" ]; then
tag="-el9"
fi
# TODO
# Delete this as soon as postgresql image reached GA
if [ "${VERSION}" == "15" ]; then
echo "WARNING: Version ${VERSION} does not reach GA."
echo "WARNING: Remove this condition as soon as it will be available."
return 0
fi
ct_os_test_image_stream_template "${THISDIR}/imagestreams/postgresql-${OS%[0-9]*}.json" "${THISDIR}/examples/postgresql-ephemeral-template.json" postgresql "-p POSTGRESQL_VERSION=${VERSION}${tag}"
}


function run_latest_imagestreams_test() {
local result=1
# Switch to root directory of a container
echo "Testing the latest version in imagestreams"
pushd "${THISDIR}/.." >/dev/null || return 1
ct_check_latest_imagestreams
result=$?
popd >/dev/null || return 1
return $result
}

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

0 comments on commit bc215c8

Please sign in to comment.