diff --git a/examples/rails-postgresql-persistent.json b/examples/rails-postgresql-persistent.json index ce404887..364b28c7 100644 --- a/examples/rails-postgresql-persistent.json +++ b/examples/rails-postgresql-persistent.json @@ -176,7 +176,7 @@ "initContainers": [ { "name": "ruby-init-container", - "image": " ", + "image": "${NAME}:latest", "command": [ "./migrate-database.sh" ], @@ -256,7 +256,7 @@ "containers": [ { "name": "${NAME}", - "image": " ", + "image": "${NAME}:latest", "ports": [ { "containerPort": 8080 @@ -439,7 +439,7 @@ "containers": [ { "name": "postgresql", - "image": " ", + "image": "postgresql:${POSTGRESQL_VERSION}", "ports": [ { "containerPort": 5432 diff --git a/examples/rails.json b/examples/rails.json index 28620b93..47bb963a 100644 --- a/examples/rails.json +++ b/examples/rails.json @@ -18,7 +18,7 @@ "message": "The following service(s) have been created in your project: ${NAME}.\n\nFor more information about using this template, including OpenShift considerations, see https://github.com/sclorg/dancer-ex/blob/master/README.md.", "labels": { "template": "rails-example", - "app": "rails-example" + "app": "${NAME}" }, "objects": [ { @@ -155,8 +155,8 @@ "spec": { "containers": [ { - "name": "rails-example", - "image": " ", + "name": "${NAME}", + "image": "${NAME}:latest", "ports": [ { "containerPort": 8080 diff --git a/test/test_ocp_helm_ruby_imagestreams.py b/test/test_ocp_helm_ruby_imagestreams.py index 1bc75107..8330f006 100644 --- a/test/test_ocp_helm_ruby_imagestreams.py +++ b/test/test_ocp_helm_ruby_imagestreams.py @@ -40,6 +40,7 @@ def test_package_imagestream(self, version, registry, expected): """ Test checks if Helm imagestreams are present """ + skip_ocp_test(reason="helm") assert self.hc_api.helm_package() assert self.hc_api.helm_installation() assert ( diff --git a/test/test_ocp_helm_ruby_rails_application.py b/test/test_ocp_helm_ruby_rails_application.py index c9143318..84b23cf6 100644 --- a/test/test_ocp_helm_ruby_rails_application.py +++ b/test/test_ocp_helm_ruby_rails_application.py @@ -38,6 +38,7 @@ def test_by_helm_test(self): Test if Helm imagestream and Helm ruby rails application work properly and respond as expected. """ + skip_ocp_test(reason="helm") self.hc_api.package_name = "redhat-ruby-imagestreams" assert self.hc_api.helm_package() assert self.hc_api.helm_installation() diff --git a/test/test_ocp_s2i_templates.py b/test/test_ocp_s2i_templates.py index 5ecc7f71..ccfcb1a1 100644 --- a/test/test_ocp_s2i_templates.py +++ b/test/test_ocp_s2i_templates.py @@ -2,7 +2,7 @@ from container_ci_suite.openshift import OpenShiftAPI -from conftest import VARS +from conftest import VARS, skip_ocp_test class TestS2IRailsTemplates: @@ -27,27 +27,27 @@ def teardown_method(self): self.oc_api.delete_project() @pytest.mark.parametrize( - "template_type", + "template_type, template_name", [ - "local", - "ex", + ("local", "rails.json"), + ("local", "rails-postgresql-persistent.json"), + ("ex", "rails.json"), + ("ex", "rails-postgresql-persistent.json"), ], ) - def test_rails_template_inside_cluster(self, template_type): + def test_rails_template_cluster(self, template_type, template_name): """ Test if Ruby s2i local templates work properly """ - assert self.oc_api.upload_image( - VARS.DEPLOYED_PSQL_IMAGE, VARS.PSQL_IMAGE_SHORT - ) + skip_ocp_test(reason="imagestream") + assert self.oc_api.upload_image(VARS.DEPLOYED_PSQL_IMAGE, VARS.PSQL_IMAGE_SHORT) service_name = f"ruby-{VARS.SHORT_VERSION}-testing" - if template_type == "local": - template_url = "examples/rails.json" - else: + template_url = f"examples/{template_name}" + if template_type == "ex": template_url = self.oc_api.get_raw_url_for_json( container="rails-ex", dir="openshift/templates", - filename="rails.json", + filename=template_name, branch=VARS.TEST_APP_BRANCH, ) openshift_args = [ @@ -56,24 +56,21 @@ def test_rails_template_inside_cluster(self, template_type): f"RUBY_VERSION={VARS.VERSION}", f"NAME={service_name}", ] - # TODO: Add postgresql persistent template - # if template != "rails.json": - # openshift_args = [ - # "SOURCE_REPOSITORY_URL=https://github.com/sclorg/rails-ex.git", - # f"SOURCE_REPOSITORY_REF={VARS.TEST_APP_BRANCH}", - # f"POSTGRESQL_VERSION={VARS.PSQL_IMAGE_TAG}", - # f"RUBY_VERSION={VARS.VERSION}", - # f"NAME={service_name}", - # "DATABASE_USER=testu", - # "DATABASE_PASSWORD=testp", - # ] + if template_name != "rails.json": + openshift_args.extend( + [ + f"POSTGRESQL_VERSION={VARS.PSQL_IMAGE_TAG}", + "DATABASE_USER=testu", + "DATABASE_PASSWORD=testp", + ] + ) assert self.oc_api.deploy_template_with_image( image_name=VARS.IMAGE_NAME, template=template_url, name_in_template="ruby", openshift_args=openshift_args, ) - assert self.oc_api.is_template_deployed(name_in_template=service_name) + assert self.oc_api.is_template_deployed(name_in_template=service_name, timeout=480) assert self.oc_api.check_response_inside_cluster( name_in_template=service_name, expected_output="Welcome to your Rails application",