Skip to content

Commit df4cc49

Browse files
committed
Fix ruby-rails application. On shared_cluster it took too
much time. Signed-off-by: Petr "Stone" Hracek <[email protected]>
1 parent fa7b893 commit df4cc49

5 files changed

+37
-14
lines changed

test/test-lib-ruby.sh

+8-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ function test_ruby_integration() {
5555

5656
# Check the imagestream
5757
function test_ruby_imagestream() {
58-
58+
if [[ "${OS}" == "rhel10" ]]; then
59+
echo "Testing templates is suppressed on RHEL10. Imagestreams do not exist yet."
60+
return
61+
fi
5962
ct_os_test_image_stream_s2i "${THISDIR}/imagestreams/ruby-${OS%[0-9]*}.json" "${IMAGE_NAME}" \
6063
"https://github.com/sclorg/s2i-ruby-container.git" \
6164
"${VERSION}/test/puma-test-app" \
@@ -82,7 +85,6 @@ function test_ruby_s2i_rails_templates() {
8285
}
8386

8487
function test_ruby_s2i_rails_persistent_templates() {
85-
8688
ct_os_test_template_app "${IMAGE_NAME}" \
8789
"https://raw.githubusercontent.com/sclorg/rails-ex/master/openshift/templates/rails-postgresql-persistent.json" \
8890
"ruby" \
@@ -109,6 +111,10 @@ function test_ruby_s2i_local_persistent_templates() {
109111
}
110112

111113
function test_ruby_s2i_local_app_templates() {
114+
if [[ "${OS}" == "rhel10" ]]; then
115+
echo "Testing templates is suppressed on RHEL10. Imagestreams do not exist yet."
116+
return
117+
fi
112118
# TODO: this was not working because the referenced example dir was added as part of this commit
113119
ct_os_test_template_app "${IMAGE_NAME}" \
114120
"${THISDIR}/examples/rails.json" \

test/test_helm_ruby_rails_application.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323

2424
TAGS = {
2525
"rhel8": "-ubi8",
26-
"rhel9": "-ubi9"
26+
"rhel9": "-ubi9",
27+
"rhel10": "-ubi10"
2728
}
2829
TAG = TAGS.get(OS, None)
2930

@@ -61,12 +62,14 @@ def test_curl_connection(self):
6162
}
6263
)
6364
assert self.hc_api.is_s2i_pod_running(pod_name_prefix="rails-example")
64-
assert self.hc_api.test_helm_curl_output(
65-
route_name="rails-example",
66-
expected_str="Welcome to your Rails application"
65+
assert self.hc_api.oc_api.check_response_inside_cluster(
66+
name_in_template="rails-example",
67+
expected_output="Welcome to your Rails application"
6768
)
6869

6970
def test_by_helm_test(self):
71+
if OS == "rhel10":
72+
pytest.skip("Do NOT test on RHEL10.")
7073
rails_ex_branch = "master"
7174
if VERSION == "3.3":
7275
rails_ex_branch = VERSION
@@ -82,5 +85,5 @@ def test_by_helm_test(self):
8285
"source_repository_ref": rails_ex_branch,
8386
}
8487
)
85-
assert self.hc_api.is_s2i_pod_running(pod_name_prefix="rails-example")
88+
assert self.hc_api.is_s2i_pod_running(pod_name_prefix="rails-example", timeout=480)
8689
assert self.hc_api.test_helm_chart(expected_str=["Welcome to your Rails application"])

test/test_s2i_imagestreams.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import os
22
import sys
33

4+
import pytest
5+
46
from container_ci_suite.openshift import OpenShiftAPI
57
from container_ci_suite.utils import check_variables
68

@@ -12,12 +14,12 @@
1214

1315
VERSION = os.getenv("VERSION")
1416
IMAGE_NAME = os.getenv("IMAGE_NAME")
15-
OS = os.getenv("OS")
17+
OS = os.getenv("TARGET")
1618

1719
SHORT_VERSION = "".join(VERSION.split("."))
1820

1921

20-
class TestRubyImagestreams:
22+
class TestRubyS2IImagestreams:
2123

2224
def setup_method(self):
2325
self.oc_api = OpenShiftAPI(pod_name_prefix="ruby", version=VERSION, shared_cluster=True)
@@ -26,6 +28,8 @@ def teardown_method(self):
2628
self.oc_api.delete_project()
2729

2830
def ruby(self):
31+
if OS == "rhel10":
32+
pytest.skip("Do NOT test on RHEL10.")
2933
service_name = f"ruby-{SHORT_VERSION}-testing"
3034
assert self.oc_api.deploy_imagestream_s2i(
3135
imagestream_file=f"{VERSION}/imagestreams/ruby-rhel.json",

test/test_s2i_local_templates.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919

2020
TAGS = {
2121
"rhel8": "-el8",
22-
"rhel9": "-el9"
22+
"rhel9": "-el9",
23+
"rhel10": "-el10",
2324
}
2425
TAG = TAGS.get(OS, None)
2526
IMAGE_SHORT = f"postgresql:12{TAG}"
@@ -43,6 +44,8 @@ def teardown_method(self):
4344
]
4445
)
4546
def test_rails_template_inside_cluster(self, template):
47+
if OS == "rhel10":
48+
pytest.skip("Do NOT test on RHEL10.")
4649
service_name = "ruby-testing"
4750
rails_ex_branch = "master"
4851
if VERSION == "3.3":

test/test_s2i_rails_ex_templates.py

+11-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919

2020
TAGS = {
2121
"rhel8": "-el8",
22-
"rhel9": "-el9"
22+
"rhel9": "-el9",
23+
"rhel10": "-el10"
2324
}
2425
TAG = TAGS.get(OS, None)
2526
IMAGE_SHORT = f"postgresql:12{TAG}"
@@ -29,8 +30,7 @@
2930
class TestS2IRailsExTemplate:
3031

3132
def setup_method(self):
32-
self.oc_api = OpenShiftAPI(pod_name_prefix="ruby-testing", version=VERSION)
33-
assert self.oc_api.upload_image(DEPLOYED_PGSQL_IMAGE, IMAGE_SHORT)
33+
self.oc_api = OpenShiftAPI(pod_name_prefix="ruby-testing", version=VERSION, shared_cluster=True)
3434

3535
def teardown_method(self):
3636
self.oc_api.delete_project()
@@ -43,6 +43,12 @@ def teardown_method(self):
4343
]
4444
)
4545
def test_rails_template_inside_cluster(self, template):
46+
if OS == "rhel10":
47+
pytest.skip("Do NOT test on RHEL10.")
48+
if self.oc_api.shared_cluster:
49+
assert self.oc_api.upload_image_to_external_registry(DEPLOYED_PGSQL_IMAGE, IMAGE_SHORT)
50+
else:
51+
assert self.oc_api.upload_image(DEPLOYED_PGSQL_IMAGE, IMAGE_SHORT)
4652
service_name = "ruby-testing"
4753
rails_ex_branch = "master"
4854
if VERSION == "3.3":
@@ -54,7 +60,8 @@ def test_rails_template_inside_cluster(self, template):
5460
f"SOURCE_REPOSITORY_URL=https://github.com/sclorg/rails-ex.git",
5561
f"SOURCE_REPOSITORY_REF={rails_ex_branch}",
5662
f"RUBY_VERSION={VERSION}",
57-
f"NAME={service_name}"
63+
f"NAME={service_name}",
64+
"MEMORY_LIMIT=1Gi",
5865
]
5966
if template != "rails.json":
6067
openshift_args = [

0 commit comments

Comments
 (0)