Skip to content

Commit 2291eac

Browse files
committedMar 6, 2025·
Fixing OpenShift Pytest test suite
Signed-off-by: Petr "Stone" Hracek <[email protected]>
1 parent 2002263 commit 2291eac

6 files changed

+30
-15
lines changed
 

‎test/test_dancer_ex_standalone.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
class TestPerlDancerExTemplate:
2121

2222
def setup_method(self):
23-
self.oc_api = OpenShiftAPI(pod_name_prefix="perl-testing", version=VERSION)
23+
self.oc_api = OpenShiftAPI(pod_name_prefix="perl-testing", version=VERSION, shared_cluster=True)
2424

2525
def teardown_method(self):
2626
self.oc_api.delete_project()
@@ -32,7 +32,7 @@ def test_dancer_ex_template_inside_cluster(self):
3232
context=".",
3333
service_name=service_name
3434
)
35-
assert self.oc_api.template_deployed(name_in_template=service_name)
35+
assert self.oc_api.template_deployed(name_in_template=service_name, timeout=480)
3636
assert self.oc_api.check_response_inside_cluster(
3737
name_in_template=service_name, expected_output="Welcome to your Dancer application on OpenShift"
3838
)

‎test/test_dancer_ex_templates.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
IMAGE_NAME = os.getenv("IMAGE_NAME")
1515
OS = os.getenv("TARGET")
1616

17+
if VERSION == "5.30-mod_fcgid":
18+
VERSION = "5.30"
19+
20+
if VERSION == "5.26-mod_fcgid":
21+
VERSION = "5.26"
22+
1723
DEPLOYED_MYSQL_IMAGE = "quay.io/sclorg/mysql-80-c9s:c9s"
1824

1925
MYSQL_TAGS = {
@@ -49,7 +55,7 @@ def test_perl_template_inside_cluster(self):
4955
"SOURCE_REPOSITORY_REF=master"
5056
]
5157
)
52-
assert self.oc_api.template_deployed(name_in_template=service_name)
58+
assert self.oc_api.template_deployed(name_in_template=service_name, timeout=480)
5359
assert self.oc_api.check_response_inside_cluster(
5460
name_in_template=service_name, expected_output="Welcome to your Dancer application on OpenShift"
5561
)
@@ -82,7 +88,7 @@ def test_perl_template_inside_cluster(self):
8288

8389
]
8490
)
85-
assert self.oc_api.template_deployed(name_in_template=service_name)
91+
assert self.oc_api.template_deployed(name_in_template=service_name, timeout=480)
8692
assert self.oc_api.check_response_inside_cluster(
8793
name_in_template=service_name, expected_output="Welcome to your Dancer application on OpenShift"
8894
)

‎test/test_deploy_templates.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
IMAGE_NAME = os.getenv("IMAGE_NAME")
1414
OS = os.getenv("TARGET")
1515

16+
if VERSION == "5.30-mod_fcgid":
17+
VERSION = "5.30"
18+
19+
if VERSION == "5.26-mod_fcgid":
20+
VERSION = "5.26"
21+
1622

1723
class TestDeployTemplate:
1824

@@ -35,7 +41,7 @@ def test_perl_template_inside_cluster(self):
3541
f"NAME={service_name}"
3642
]
3743
)
38-
assert self.oc_api.template_deployed(name_in_template=service_name)
44+
assert self.oc_api.template_deployed(name_in_template=service_name, timeout=480)
3945
assert self.oc_api.check_response_inside_cluster(
4046
name_in_template=service_name, expected_output="Everything is OK"
4147
)

‎test/test_helm_dancer_app.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class TestHelmPerlDancerAppTemplate:
3636
def setup_method(self):
3737
package_name = "redhat-perl-dancer-application"
3838
path = test_dir
39-
self.hc_api = HelmChartsAPI(path=path, package_name=package_name, tarball_dir=test_dir)
39+
self.hc_api = HelmChartsAPI(path=path, package_name=package_name, tarball_dir=test_dir, shared_cluster=True)
4040
self.hc_api.clone_helm_chart_repo(
4141
repo_url="https://github.com/sclorg/helm-charts", repo_name="helm-charts",
4242
subdir="charts/redhat"

‎test/test_helm_dancer_mysql_template.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class TestHelmPerlDancerMysqlAppTemplate:
3535
def setup_method(self):
3636
package_name = "redhat-perl-dancer-application"
3737
path = test_dir
38-
self.hc_api = HelmChartsAPI(path=path, package_name=package_name, tarball_dir=test_dir)
38+
self.hc_api = HelmChartsAPI(path=path, package_name=package_name, tarball_dir=test_dir, shared_cluster=True)
3939
self.hc_api.clone_helm_chart_repo(
4040
repo_url="https://github.com/sclorg/helm-charts", repo_name="helm-charts",
4141
subdir="charts/redhat"
@@ -58,7 +58,7 @@ def test_dancer_application(self):
5858
"namespace": self.hc_api.namespace
5959
}
6060
)
61-
assert self.hc_api.is_s2i_pod_running(pod_name_prefix="dancer-example", timeout=400)
61+
assert self.hc_api.is_s2i_pod_running(pod_name_prefix="dancer-example", timeout=480)
6262
assert self.hc_api.oc_api.check_response_inside_cluster(
6363
name_in_template="dancer-example",
6464
expected_output="Welcome to your Dancer application"
@@ -77,5 +77,5 @@ def test_dancer_application_helm_test(self):
7777
"namespace": self.hc_api.namespace
7878
}
7979
)
80-
assert self.hc_api.is_s2i_pod_running(pod_name_prefix="dancer-example", timeout=400)
80+
assert self.hc_api.is_s2i_pod_running(pod_name_prefix="dancer-example", timeout=480)
8181
assert self.hc_api.test_helm_chart(expected_str=["Welcome to your Dancer application"])

‎test/test_imagestreams_quickstart.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,23 @@
2424

2525
TAG = TAGS.get(OS, None)
2626

27+
if VERSION == "5.30-mod_fcgid":
28+
VERSION = "5.30"
29+
30+
if VERSION == "5.26-mod_fcgid":
31+
VERSION = "5.26"
32+
2733

2834
# Replacement with 'test_python_s2i_templates'
2935
class TestImagestreamsQuickstart:
3036

3137
def setup_method(self):
32-
self.oc_api = OpenShiftAPI(pod_name_prefix="perl-testing", version=VERSION)
38+
self.oc_api = OpenShiftAPI(pod_name_prefix="perl-testing", version=VERSION, shared_cluster=True)
3339

3440
def teardown_method(self):
3541
self.oc_api.delete_project()
3642

3743
def test_perl_template_inside_cluster(self):
38-
new_version = VERSION
39-
if VERSION == "5.26-mod_fcgid":
40-
new_version = "5.26"
4144
service_name = "perl-testing"
4245
assert self.oc_api.imagestream_quickstart(
4346
imagestream_file="imagestreams/perl-rhel.json",
@@ -46,11 +49,11 @@ def test_perl_template_inside_cluster(self):
4649
name_in_template="perl",
4750
openshift_args=[
4851
f"SOURCE_REPOSITORY_REF=master",
49-
f"VERSION={new_version}{TAG}",
52+
f"VERSION={VERSION}{TAG}",
5053
f"NAME={service_name}"
5154
]
5255
)
53-
assert self.oc_api.template_deployed(name_in_template=service_name)
56+
assert self.oc_api.template_deployed(name_in_template=service_name, timeout=480)
5457
assert self.oc_api.check_response_inside_cluster(
5558
name_in_template=service_name, expected_output="Everything is OK"
5659
)

0 commit comments

Comments
 (0)
Please sign in to comment.