diff --git a/examples/redis-ephemeral-template.json b/examples/redis-ephemeral-template.json index f00f8e9..469ca75 100644 --- a/examples/redis-ephemeral-template.json +++ b/examples/redis-ephemeral-template.json @@ -62,41 +62,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\":\"redis:${REDIS_VERSION}\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]" } }, "spec": { "strategy": { "type": "Recreate" }, - "triggers": [ - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "redis" - ], - "from": { - "kind": "ImageStreamTag", - "name": "redis:${REDIS_VERSION}", - "namespace": "${NAMESPACE}" - }, - "lastTriggeredImage": "" - } - }, - { - "type": "ConfigChange" - } - ], "replicas": 1, "selector": { - "name": "${DATABASE_SERVICE_NAME}" + "matchLabels": { + "name": "${DATABASE_SERVICE_NAME}" + } }, "template": { "metadata": { diff --git a/examples/redis-persistent-template.json b/examples/redis-persistent-template.json index f4815cf..abe3651 100644 --- a/examples/redis-persistent-template.json +++ b/examples/redis-persistent-template.json @@ -79,41 +79,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\":\"redis:${REDIS_VERSION}\"},\"fieldPath\": \"spec.template.spec.containers[0].image\"}]" } }, "spec": { "strategy": { "type": "Recreate" }, - "triggers": [ - { - "type": "ImageChange", - "imageChangeParams": { - "automatic": true, - "containerNames": [ - "redis" - ], - "from": { - "kind": "ImageStreamTag", - "name": "redis:${REDIS_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-redis.sh b/test/test-lib-redis.sh index 58a073d..ed0c457 100644 --- a/test/test-lib-redis.sh +++ b/test/test-lib-redis.sh @@ -14,13 +14,22 @@ source "${THISDIR}/test-lib-remote-openshift.sh" function test_redis_integration() { local service_name=redis - ct_os_test_template_app_func "${IMAGE_NAME}" \ - "https://raw.githubusercontent.com/openshift/origin/master/examples/db-templates/redis-ephemeral-template.json" \ + if [ "${OS}" == "rhel7" ]; then + namespace_image="rhscl/redis-${VERSION}-rhel7" + else + namespace_image="${OS}/redis-${VERSION}" + fi + TEMPLATES="redis-ephemeral-template.json + redis-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' 'timeout 15 redis-cli -h -a testp ping' 'PONG'" \ + "ct_os_check_cmd_internal 'registry.redhat.io/${namespace_image}' '${service_name}-testing' 'timeout 15 redis-cli -h -a testp ping' 'PONG'" \ "-p REDIS_VERSION=${VERSION} \ -p DATABASE_SERVICE_NAME="${service_name}-testing" \ -p REDIS_PASSWORD=testp" + done } # Check the imagestream @@ -35,7 +44,11 @@ function test_redis_imagestream() { elif [ "${OS}" == "rhel9" ]; then tag="-el9" fi - ct_os_test_image_stream_template "${THISDIR}/imagestreams/redis-${OS%[0-9]*}.json" "${THISDIR}/examples/redis-ephemeral-template.json" redis "-p REDIS_VERSION=${VERSION}${tag}" + TEMPLATES="redis-ephemeral-template.json + redis-persistent-template.json" + for template in $TEMPLATES; do + ct_os_test_image_stream_template "${THISDIR}/imagestreams/redis-${OS%[0-9]*}.json" "${THISDIR}/examples/${template}" redis "-p REDIS_VERSION=${VERSION}${tag}" + done } function test_latest_imagestreams() {