Skip to content

Commit 4ada33c

Browse files
authored
Merge pull request #184 from sclorg/fix_test_suite
Fix test suite and move ruby version to 3.3-ubi9
2 parents ca07a94 + 9e03a0b commit 4ada33c

File tree

6 files changed

+20
-61
lines changed

6 files changed

+20
-61
lines changed

.github/workflows/openshift-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
strategy:
1111
fail-fast: false
1212
matrix:
13-
version: [ "2.5-ubi8", "3.0-ubi9", "3.3-ubi8", "3.3-ubi9" ]
13+
version: [ "2.5-ubi8", "3.0-ubi9", "3.3-ubi8", "3.3-ubi9", "3.3-ubi10" ]
1414

1515
if: |
1616
github.event.issue.pull_request

openshift/templates/rails-postgresql-persistent.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,9 +528,9 @@
528528
{
529529
"name": "RUBY_VERSION",
530530
"displayName": "Ruby Version",
531-
"description": "Version of Ruby image to be used (3.3-ubi8 by default).",
531+
"description": "Version of Ruby image to be used (3.3-ubi9 by default).",
532532
"required": true,
533-
"value": "3.3-ubi8"
533+
"value": "3.3-ubi9"
534534
},
535535
{
536536
"name": "POSTGRESQL_VERSION",

openshift/templates/rails-postgresql.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,9 +503,9 @@
503503
{
504504
"name": "RUBY_VERSION",
505505
"displayName": "Ruby Version",
506-
"description": "Version of Ruby image to be used (3.3-ubi8 by default).",
506+
"description": "Version of Ruby image to be used (3.3-ubi9 by default).",
507507
"required": true,
508-
"value": "3.3-ubi8"
508+
"value": "3.3-ubi9"
509509
},
510510
{
511511
"name": "POSTGRESQL_VERSION",

openshift/templates/rails.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,9 @@
214214
{
215215
"name": "RUBY_VERSION",
216216
"displayName": "Ruby Version",
217-
"description": "Version of Ruby image to be used (3.3-ubi8 by default).",
217+
"description": "Version of Ruby image to be used (3.3-ubi9 by default).",
218218
"required": true,
219-
"value": "3.3-ubi8"
219+
"value": "3.3-ubi9"
220220
},
221221
{
222222
"name": "MEMORY_LIMIT",

tests/test_rails.py

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99

1010
VERSION=os.getenv("SINGLE_VERSION")
1111
if not VERSION:
12-
VERSION="3.1-ubi8"
12+
VERSION="3.3-ubi9"
1313

1414
class TestRailsAppExTemplate:
1515

1616
def setup_method(self):
17-
self.oc_api = OpenShiftAPI(pod_name_prefix="rails-example")
17+
self.oc_api = OpenShiftAPI(pod_name_prefix="rails-example", shared_cluster=True)
1818
json_raw_file = self.oc_api.get_raw_url_for_json(
1919
container="s2i-ruby-container", dir="imagestreams", filename="ruby-rhel.json"
2020
)
@@ -36,25 +36,7 @@ def test_template_inside_cluster(self):
3636
template=template_json, name_in_template="rails-example", expected_output=expected_output,
3737
openshift_args=[f"SOURCE_REPOSITORY_REF={branch_to_test}", f"RUBY_VERSION={VERSION}", "NAME=rails-example"]
3838
)
39-
assert self.oc_api.template_deployed(name_in_template="rails-example")
39+
assert self.oc_api.is_template_deployed(name_in_template="rails-example", timeout=600)
4040
assert self.oc_api.check_response_inside_cluster(
4141
name_in_template="rails-example", expected_output=expected_output
4242
)
43-
44-
def test_template_by_request(self):
45-
if VERSION.startswith("3.3"):
46-
branch_to_test = "3.3"
47-
else:
48-
branch_to_test = "master"
49-
expected_output = "Welcome to your Rails application"
50-
template_json = self.oc_api.get_raw_url_for_json(
51-
container="rails-ex", branch=branch_to_test, dir="openshift/templates", filename="rails.json"
52-
)
53-
assert self.oc_api.deploy_template(
54-
template=template_json, name_in_template="rails-example", expected_output=expected_output,
55-
openshift_args=[f"SOURCE_REPOSITORY_REF={branch_to_test}", f"RUBY_VERSION={VERSION}", "NAME=rails-example"]
56-
)
57-
assert self.oc_api.template_deployed(name_in_template="rails-example")
58-
assert self.oc_api.check_response_outside_cluster(
59-
name_in_template="rails-example", expected_output=expected_output
60-
)

tests/test_rails_postgresql.py

Lines changed: 10 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,12 @@
99

1010
VERSION=os.getenv("SINGLE_VERSION")
1111
if not VERSION:
12-
VERSION="3.1-ubi8"
12+
VERSION="3.3-ubi9"
1313

1414
class TestRailsAppWithPostgreSQLExTemplate:
1515

1616
def setup_method(self):
17-
self.oc_api = OpenShiftAPI(pod_name_prefix="rails-example")
18-
json_raw_file = self.oc_api.get_raw_url_for_json(
19-
container="s2i-ruby-container", dir="imagestreams", filename="ruby-rhel.json"
20-
)
21-
self.oc_api.import_is(path=json_raw_file, name="ruby")
22-
json_raw_file = self.oc_api.get_raw_url_for_json(
23-
container="postgresql-container", dir="imagestreams", filename="postgresql-rhel.json"
24-
)
25-
self.oc_api.import_is(path=json_raw_file, name="postgresql")
17+
self.oc_api = OpenShiftAPI(pod_name_prefix="rails-example", shared_cluster=True)
2618

2719
def teardown_method(self):
2820
self.oc_api.delete_project()
@@ -32,29 +24,14 @@ def test_template_inside_cluster(self):
3224
branch_to_test = "3.3"
3325
else:
3426
branch_to_test = "master"
35-
expected_output = "Welcome to your Rails application"
36-
template_json = self.oc_api.get_raw_url_for_json(
37-
container="rails-ex", branch=branch_to_test, dir="openshift/templates", filename="rails-postgresql-persistent.json"
38-
)
39-
assert self.oc_api.deploy_template(
40-
template=template_json, name_in_template="rails-example", expected_output=expected_output,
41-
openshift_args=[
42-
f"SOURCE_REPOSITORY_REF={branch_to_test}",
43-
f"RUBY_VERSION={VERSION}",
44-
"NAME=rails-example",
45-
"POSTGRESQL_VERSION=12-el8"
46-
]
27+
json_raw_file = self.oc_api.get_raw_url_for_json(
28+
container="s2i-ruby-container", dir="imagestreams", filename="ruby-rhel.json"
4729
)
48-
assert self.oc_api.template_deployed(name_in_template="rails-example")
49-
assert self.oc_api.check_response_inside_cluster(
50-
name_in_template="rails-example", expected_output=expected_output
30+
self.oc_api.import_is(path=json_raw_file, name="ruby", skip_check=True)
31+
json_raw_file = self.oc_api.get_raw_url_for_json(
32+
container="postgresql-container", dir="imagestreams", filename="postgresql-rhel.json"
5133
)
52-
53-
def test_template_by_request(self):
54-
if VERSION.startswith("3.3"):
55-
branch_to_test = "3.3"
56-
else:
57-
branch_to_test = "master"
34+
self.oc_api.import_is(path=json_raw_file, name="postgresql", skip_check=True)
5835
expected_output = "Welcome to your Rails application"
5936
template_json = self.oc_api.get_raw_url_for_json(
6037
container="rails-ex", branch=branch_to_test, dir="openshift/templates", filename="rails-postgresql-persistent.json"
@@ -68,7 +45,7 @@ def test_template_by_request(self):
6845
"POSTGRESQL_VERSION=12-el8"
6946
]
7047
)
71-
assert self.oc_api.template_deployed(name_in_template="rails-example")
72-
assert self.oc_api.check_response_outside_cluster(
48+
assert self.oc_api.is_template_deployed(name_in_template="rails-example", timeout=600)
49+
assert self.oc_api.check_response_inside_cluster(
7350
name_in_template="rails-example", expected_output=expected_output
7451
)

0 commit comments

Comments
 (0)