From e043ffcf165af776c8420cc09363b0fde432b184 Mon Sep 17 00:00:00 2001 From: "Petr \"Stone\" Hracek" Date: Mon, 27 Apr 2026 09:51:50 +0200 Subject: [PATCH 1/3] Fix using rails-ex repo and rails-postgresql-persistent.json file Missing image definitions Signed-off-by: Petr "Stone" Hracek --- examples/rails-postgresql-persistent.json | 6 ++-- examples/rails.json | 4 +-- test/test_ocp_s2i_templates.py | 40 ++++++++++------------- 3 files changed, 23 insertions(+), 27 deletions(-) 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..b26156d2 100644 --- a/examples/rails.json +++ b/examples/rails.json @@ -155,8 +155,8 @@ "spec": { "containers": [ { - "name": "rails-example", - "image": " ", + "name": "${NAME}", + "image": "${NAME}:latest", "ports": [ { "containerPort": 8080 diff --git a/test/test_ocp_s2i_templates.py b/test/test_ocp_s2i_templates.py index 5ecc7f71..a58c2844 100644 --- a/test/test_ocp_s2i_templates.py +++ b/test/test_ocp_s2i_templates.py @@ -27,27 +27,26 @@ 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 - ) + 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,17 +55,14 @@ 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, From bb378153bedba781dc7f8500e519d3a2c6cfcf0f Mon Sep 17 00:00:00 2001 From: "Petr \"Stone\" Hracek" Date: Tue, 28 Apr 2026 12:38:44 +0200 Subject: [PATCH 2/3] Skip tests for version 4.0, that is available after GA Signed-off-by: Petr "Stone" Hracek --- test/test_ocp_helm_ruby_imagestreams.py | 1 + test/test_ocp_helm_ruby_rails_application.py | 1 + test/test_ocp_s2i_templates.py | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) 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 a58c2844..018d28aa 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: @@ -39,6 +39,7 @@ def test_rails_template_cluster(self, template_type, template_name): """ Test if Ruby s2i local templates work properly """ + 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" template_url = f"examples/{template_name}" From 5c556b4e15657e3d0c0dcf8826490ef085fab192 Mon Sep 17 00:00:00 2001 From: "Petr \"Stone\" Hracek" Date: Tue, 28 Apr 2026 13:08:38 +0200 Subject: [PATCH 3/3] Increase timeout Signed-off-by: Petr "Stone" Hracek --- examples/rails.json | 2 +- test/test_ocp_s2i_templates.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/rails.json b/examples/rails.json index b26156d2..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": [ { diff --git a/test/test_ocp_s2i_templates.py b/test/test_ocp_s2i_templates.py index 018d28aa..ccfcb1a1 100644 --- a/test/test_ocp_s2i_templates.py +++ b/test/test_ocp_s2i_templates.py @@ -70,7 +70,7 @@ def test_rails_template_cluster(self, template_type, template_name): 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",