Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/rails-postgresql-persistent.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
"initContainers": [
{
"name": "ruby-init-container",
"image": " ",
"image": "${NAME}:latest",
"command": [
"./migrate-database.sh"
],
Expand Down Expand Up @@ -256,7 +256,7 @@
"containers": [
{
"name": "${NAME}",
"image": " ",
"image": "${NAME}:latest",
"ports": [
{
"containerPort": 8080
Expand Down Expand Up @@ -439,7 +439,7 @@
"containers": [
{
"name": "postgresql",
"image": " ",
"image": "postgresql:${POSTGRESQL_VERSION}",
"ports": [
{
"containerPort": 5432
Expand Down
6 changes: 3 additions & 3 deletions examples/rails.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
{
Expand Down Expand Up @@ -155,8 +155,8 @@
"spec": {
"containers": [
{
"name": "rails-example",
"image": " ",
"name": "${NAME}",
"image": "${NAME}:latest",
"ports": [
{
"containerPort": 8080
Expand Down
1 change: 1 addition & 0 deletions test/test_ocp_helm_ruby_imagestreams.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
1 change: 1 addition & 0 deletions test/test_ocp_helm_ruby_rails_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
45 changes: 21 additions & 24 deletions test/test_ocp_s2i_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from container_ci_suite.openshift import OpenShiftAPI

from conftest import VARS
from conftest import VARS, skip_ocp_test


class TestS2IRailsTemplates:
Expand All @@ -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 = [
Expand All @@ -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",
Expand Down