Skip to content

Commit

Permalink
Add testing use case for rails-postgresql template
Browse files Browse the repository at this point in the history
Signed-off-by: Petr "Stone" Hracek <[email protected]>
  • Loading branch information
phracek committed Nov 29, 2023
1 parent 073abfd commit 728fc3b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 2 additions & 0 deletions test/run-openshift-remote-cluster
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ ct_os_check_login || exit $OC_ERR

ct_os_tag_image_for_cvp "ruby"

ct_pull_or_import_postgresql || exit $OC_ERR

set -u

# For testing on OpenShift 4 we use internal registry
Expand Down
23 changes: 21 additions & 2 deletions test/test-lib-ruby.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,24 @@ THISDIR=$(dirname ${BASH_SOURCE[0]})
source "${THISDIR}/test-lib.sh"
source "${THISDIR}/test-lib-openshift.sh"

function ct_pull_or_import_postgresql() {
postgresql_image="quay.io/sclorg/postgresql-12-c8s"
image_short="postgresql:12"
image_tag="${image_short}"
# Variable CVP is set by CVP pipeline
if [ "${CVP:-0}" -eq "0" ]; then
# In case of container or OpenShift 4 tests
# Pull image before going through tests
# Exit in case of failure, because postgresql container is mandatory
ct_pull_image "${postgresql_image}" "true"
else
# Import postgresql-10-centos7 image before running tests on CVP
oc import-image "${image_short}:latest" --from="${postgresql_image}:latest" --insecure=true --confirm
# Tag postgresql image to "postgresql:10" which is expected by test suite
oc tag "${image_short}:latest" "${image_tag}"
fi
}

function test_ruby_integration() {
ct_os_test_s2i_app "${IMAGE_NAME}" \
"https://github.com/sclorg/s2i-ruby-container.git" \
Expand Down Expand Up @@ -38,11 +56,12 @@ function test_ruby_imagestream() {
function test_ruby_s2i_templates() {
# TODO: this was not working because the referenced example dir was added as part of this commit
ct_os_test_template_app "${IMAGE_NAME}" \
"${THISDIR}/rails-postgresql.json" \
"https://raw.githubusercontent.com/phracek/rails-ex/migrate_deployment/openshift/templates/rails-postgresql.json" \
ruby \
"Everything is OK" \
8080 http 200 \
"-p SOURCE_REPOSITORY_REF=master -p VERSION=${VERSION} -p NAME=rails-postgresql-example"
"-p SOURCE_REPOSITORY_REF=master -p RUBY_VERSION=${VERSION} -p NAME=rails-postgresql-example" \
"quay.io/sclorg/postgresql-12-c8s|postgresql:12-el8"
}

function test_latest_imagestreams() {
Expand Down

0 comments on commit 728fc3b

Please sign in to comment.