diff --git a/examples/postgresql-ephemeral-template.json b/examples/postgresql-ephemeral-template.json index bf5bf57a..31674d1e 100644 --- a/examples/postgresql-ephemeral-template.json +++ b/examples/postgresql-ephemeral-template.json @@ -66,41 +66,24 @@ } }, { - "kind": "DeploymentConfig", - "apiVersion": "apps.openshift.io/v1", + "kind": "Deployment", + "apiVersion": "apps/v1", "metadata": { "name": "${DATABASE_SERVICE_NAME}", "annotations": { - "template.alpha.openshift.io/wait-for-ready": "true" + "template.alpha.openshift.io/wait-for-ready": "true", + "image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"postgresql:${POSTGRESQL_VERSION}\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]" } }, "spec": { "strategy": { "type": "Recreate" }, - "triggers": [ - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "postgresql" - ], - "from": { - "kind": "ImageStreamTag", - "name": "postgresql:${POSTGRESQL_VERSION}", - "namespace": "${NAMESPACE}" - }, - "lastTriggeredImage": "" - } - }, - { - "type": "ConfigChange" - } - ], "replicas": 1, "selector": { - "name": "${DATABASE_SERVICE_NAME}" + "matchLabels": { + "name": "${DATABASE_SERVICE_NAME}" + } }, "template": { "metadata": { diff --git a/examples/postgresql-persistent-template.json b/examples/postgresql-persistent-template.json index 312ecd91..fa131ed8 100644 --- a/examples/postgresql-persistent-template.json +++ b/examples/postgresql-persistent-template.json @@ -83,41 +83,24 @@ } }, { - "kind": "DeploymentConfig", - "apiVersion": "apps.openshift.io/v1", + "kind": "Deployment", + "apiVersion": "apps/v1", "metadata": { "name": "${DATABASE_SERVICE_NAME}", "annotations": { - "template.alpha.openshift.io/wait-for-ready": "true" + "template.alpha.openshift.io/wait-for-ready": "true", + "image.openshift.io/triggers": "[{\"from\":{\"kind\":\"ImageStreamTag\",\"name\":\"postgresql:${POSTGRESQL_VERSION}\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]" } }, "spec": { "strategy": { "type": "Recreate" }, - "triggers": [ - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "postgresql" - ], - "from": { - "kind": "ImageStreamTag", - "name": "postgresql:${POSTGRESQL_VERSION}", - "namespace": "${NAMESPACE}" - }, - "lastTriggeredImage": "" - } - }, - { - "type": "ConfigChange" - } - ], "replicas": 1, "selector": { - "name": "${DATABASE_SERVICE_NAME}" + "matchLabels": { + "name": "${DATABASE_SERVICE_NAME}" + } }, "template": { "metadata": { diff --git a/test/test-lib-postgresql.sh b/test/test-lib-postgresql.sh index 6242ff3a..998c6814 100644 --- a/test/test-lib-postgresql.sh +++ b/test/test-lib-postgresql.sh @@ -14,13 +14,18 @@ source "${THISDIR}"/test-lib-remote-openshift.sh function test_postgresql_integration() { local service_name=postgresql + if [ "${OS}" == "rhel7" ]; then + namespace_image="rhscl/postgresql-${VERSION}-rhel7" + else + namespace_image="${OS}/postgresql-${VERSION}" + fi 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 '' '${service_name}-testing' 'PGPASSWORD=testp pg_isready -t 15 -h -U testu -d testdb' 'accepting connections' 120" \ + "ct_os_check_cmd_internal 'registry.redhat.io/${namespace_image}' '${service_name}-testing' 'PGPASSWORD=testp pg_isready -t 15 -h -U testu -d testdb' 'accepting connections' 120" \ "-p POSTGRESQL_VERSION=${VERSION} \ -p DATABASE_SERVICE_NAME="${service_name}-testing" \ -p POSTGRESQL_USER=testu \ @@ -37,8 +42,11 @@ function test_postgresql_imagestream() { elif [ "${OS}" == "rhel9" ]; then tag="-el9" 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}" + TEMPLATES="postgresql-ephemeral-template.json + postgresql-persistent-template.json" + for template in $TEMPLATES; do + ct_os_test_image_stream_template "${THISDIR}/imagestreams/postgresql-${OS%[0-9]*}.json" "${THISDIR}/examples/${template}" postgresql "-p POSTGRESQL_VERSION=${VERSION}${tag}" + done }