Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix OpenShift tests. Allow persistent and ephemeral template for test…
Browse files Browse the repository at this point in the history
…ing.

Check run_latest_imagestreams.

Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
phracek committed Feb 28, 2023
1 parent c1e0729 commit 67e8f0e
Showing 4 changed files with 28 additions and 10 deletions.
1 change: 1 addition & 0 deletions test/postgresql-ephemeral-template.json
1 change: 1 addition & 0 deletions test/postgresql-persistent-template.json
1 change: 1 addition & 0 deletions test/run-openshift-remote-cluster
Original file line number Diff line number Diff line change
@@ -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
35 changes: 25 additions & 10 deletions test/test-lib-postgresql.sh
Original file line number Diff line number Diff line change
@@ -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}/${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
@@ -37,4 +40,16 @@ function test_postgresql_imagestream() {
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 67e8f0e

Please sign in to comment.