Skip to content

Commit e043ffc

Browse files
committed
Fix using rails-ex repo and rails-postgresql-persistent.json file
Missing image definitions Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
1 parent fdffabd commit e043ffc

3 files changed

Lines changed: 23 additions & 27 deletions

File tree

examples/rails-postgresql-persistent.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@
176176
"initContainers": [
177177
{
178178
"name": "ruby-init-container",
179-
"image": " ",
179+
"image": "${NAME}:latest",
180180
"command": [
181181
"./migrate-database.sh"
182182
],
@@ -256,7 +256,7 @@
256256
"containers": [
257257
{
258258
"name": "${NAME}",
259-
"image": " ",
259+
"image": "${NAME}:latest",
260260
"ports": [
261261
{
262262
"containerPort": 8080
@@ -439,7 +439,7 @@
439439
"containers": [
440440
{
441441
"name": "postgresql",
442-
"image": " ",
442+
"image": "postgresql:${POSTGRESQL_VERSION}",
443443
"ports": [
444444
{
445445
"containerPort": 5432

examples/rails.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@
155155
"spec": {
156156
"containers": [
157157
{
158-
"name": "rails-example",
159-
"image": " ",
158+
"name": "${NAME}",
159+
"image": "${NAME}:latest",
160160
"ports": [
161161
{
162162
"containerPort": 8080

test/test_ocp_s2i_templates.py

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,27 +27,26 @@ def teardown_method(self):
2727
self.oc_api.delete_project()
2828

2929
@pytest.mark.parametrize(
30-
"template_type",
30+
"template_type, template_name",
3131
[
32-
"local",
33-
"ex",
32+
("local", "rails.json"),
33+
("local", "rails-postgresql-persistent.json"),
34+
("ex", "rails.json"),
35+
("ex", "rails-postgresql-persistent.json"),
3436
],
3537
)
36-
def test_rails_template_inside_cluster(self, template_type):
38+
def test_rails_template_cluster(self, template_type, template_name):
3739
"""
3840
Test if Ruby s2i local templates work properly
3941
"""
40-
assert self.oc_api.upload_image(
41-
VARS.DEPLOYED_PSQL_IMAGE, VARS.PSQL_IMAGE_SHORT
42-
)
42+
assert self.oc_api.upload_image(VARS.DEPLOYED_PSQL_IMAGE, VARS.PSQL_IMAGE_SHORT)
4343
service_name = f"ruby-{VARS.SHORT_VERSION}-testing"
44-
if template_type == "local":
45-
template_url = "examples/rails.json"
46-
else:
44+
template_url = f"examples/{template_name}"
45+
if template_type == "ex":
4746
template_url = self.oc_api.get_raw_url_for_json(
4847
container="rails-ex",
4948
dir="openshift/templates",
50-
filename="rails.json",
49+
filename=template_name,
5150
branch=VARS.TEST_APP_BRANCH,
5251
)
5352
openshift_args = [
@@ -56,17 +55,14 @@ def test_rails_template_inside_cluster(self, template_type):
5655
f"RUBY_VERSION={VARS.VERSION}",
5756
f"NAME={service_name}",
5857
]
59-
# TODO: Add postgresql persistent template
60-
# if template != "rails.json":
61-
# openshift_args = [
62-
# "SOURCE_REPOSITORY_URL=https://github.com/sclorg/rails-ex.git",
63-
# f"SOURCE_REPOSITORY_REF={VARS.TEST_APP_BRANCH}",
64-
# f"POSTGRESQL_VERSION={VARS.PSQL_IMAGE_TAG}",
65-
# f"RUBY_VERSION={VARS.VERSION}",
66-
# f"NAME={service_name}",
67-
# "DATABASE_USER=testu",
68-
# "DATABASE_PASSWORD=testp",
69-
# ]
58+
if template_name != "rails.json":
59+
openshift_args.extend(
60+
[
61+
f"POSTGRESQL_VERSION={VARS.PSQL_IMAGE_TAG}",
62+
"DATABASE_USER=testu",
63+
"DATABASE_PASSWORD=testp",
64+
]
65+
)
7066
assert self.oc_api.deploy_template_with_image(
7167
image_name=VARS.IMAGE_NAME,
7268
template=template_url,

0 commit comments

Comments
 (0)