Skip to content

Commit 3b98367

Browse files
committed
Fix nginx-container OpenShift 4 tests
Signed-off-by: Petr "Stone" Hracek <[email protected]>
1 parent 3bc6f4c commit 3b98367

File tree

4 files changed

+23
-18
lines changed

4 files changed

+23
-18
lines changed

test/run-openshift-pytest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ THISDIR=$(dirname ${BASH_SOURCE[0]})
1010

1111
git show -s
1212

13-
cd "${THISDIR}" && python3.12 -m pytest -s -rA --showlocals -vv test_nginx_*.py
13+
cd "${THISDIR}" && python3.12 -m pytest -s -rA --showlocals -vv test_*.py

test/test_nginx_imagestream_s2i.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
OS = os.getenv("OS")
1515
VERSION = os.getenv("VERSION")
1616

17+
TAGS = {
18+
"rhel8": "-ubi8",
19+
"rhel9": "-ubi9"
20+
}
21+
TAG = TAGS.get(OS, None)
1722

1823
# bash test=test_nginx_imagestream
1924
class TestNginxImagestreamS2I:

test/test_shared_helm_nginx_imagestreams.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
class TestHelmRHELNginxImageStreams:
1919

2020
def setup_method(self):
21-
package_name = "nginx-imagestreams"
21+
package_name = "redhat-nginx-imagestreams"
2222
path = test_dir
2323
self.hc_api = HelmChartsAPI(path=path, package_name=package_name, tarball_dir=test_dir)
2424
self.hc_api.clone_helm_chart_repo(
@@ -30,17 +30,17 @@ def teardown_method(self):
3030
self.hc_api.delete_project()
3131

3232
@pytest.mark.parametrize(
33-
"version,registry",
33+
"version,registry,expected",
3434
[
35-
("1.24-ubi9", "registry.redhat.io/ubi9/nginx-124:latest"),
36-
("1.24-ubi8", "registry.redhat.io/ubi8/nginx-124:latest"),
37-
("1.22-ubi9", "registry.redhat.io/ubi9/nginx-122:latest"),
38-
("1.22-ubi8", "registry.redhat.io/ubi8/nginx-122:latest"),
39-
("1.20-ubi9", "registry.redhat.io/ubi9/nginx-120:latest"),
40-
("1.20-ubi8", "registry.redhat.io/ubi8/nginx-120:latest"),
35+
("1.24-ubi9", "registry.redhat.io/ubi9/nginx-124:latest", True),
36+
("1.24-ubi8", "registry.redhat.io/ubi8/nginx-124:latest", True),
37+
("1.22-ubi9", "registry.redhat.io/ubi9/nginx-122:latest", True),
38+
("1.22-ubi8", "registry.redhat.io/ubi8/nginx-122:latest", True),
39+
("1.20-ubi9", "registry.redhat.io/ubi9/nginx-120:latest", True),
40+
("1.20-ubi8", "registry.redhat.io/ubi8/nginx-120:latest", False),
4141
],
4242
)
43-
def test_package_imagestream(self, version, registry):
43+
def test_package_imagestream(self, version, registry, expected):
4444
assert self.hc_api.helm_package()
4545
assert self.hc_api.helm_installation()
46-
assert self.hc_api.check_imagestreams(version=version, registry=registry)
46+
assert self.hc_api.check_imagestreams(version=version, registry=registry) == expected

test/test_shared_helm_nginx_template.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
class TestHelmNginxTemplate:
3030

3131
def setup_method(self):
32-
package_name = "nginx-template"
32+
package_name = "redhat-nginx-template"
3333
path = test_dir
34-
self.hc_api = HelmChartsAPI(path=path, package_name=package_name, tarball_dir=test_dir)
34+
self.hc_api = HelmChartsAPI(path=path, package_name=package_name, tarball_dir=test_dir, shared_cluster=True)
3535
self.hc_api.clone_helm_chart_repo(
3636
repo_url="https://github.com/sclorg/helm-charts", repo_name="helm-charts",
3737
subdir="charts/redhat"
@@ -41,15 +41,15 @@ def teardown_method(self):
4141
self.hc_api.delete_project()
4242

4343
def test_curl_connection(self):
44-
if self.hc_api.oc_api.shared_cluster:
44+
if self.hc_api.shared_cluster:
4545
pytest.skip("Do NOT test on shared cluster")
4646
new_version = VERSION
4747
if "micro" in VERSION:
4848
new_version = VERSION.replace("-micro", "")
49-
self.hc_api.package_name = "nginx-imagestreams"
49+
self.hc_api.package_name = "redhat-nginx-imagestreams"
5050
assert self.hc_api.helm_package()
5151
assert self.hc_api.helm_installation()
52-
self.hc_api.package_name = "nginx-template"
52+
self.hc_api.package_name = "redhat-nginx-template"
5353
assert self.hc_api.helm_package()
5454
assert self.hc_api.helm_installation(
5555
values={
@@ -65,13 +65,13 @@ def test_curl_connection(self):
6565
)
6666

6767
def test_helm_connection(self):
68-
self.hc_api.package_name = "nginx-imagestreams"
68+
self.hc_api.package_name = "redhat-nginx-imagestreams"
6969
new_version = VERSION
7070
if "micro" in VERSION:
7171
new_version = VERSION.replace("-micro", "")
7272
assert self.hc_api.helm_package()
7373
assert self.hc_api.helm_installation()
74-
self.hc_api.package_name = "nginx-template"
74+
self.hc_api.package_name = "redhat-nginx-template"
7575
assert self.hc_api.helm_package()
7676
assert self.hc_api.helm_installation(
7777
values={

0 commit comments

Comments
 (0)