Skip to content

Commit fe178bb

Browse files
committed
Remove run-openshift that are deprecated. Adds helm charts tests
Signed-off-by: Petr "Stone" Hracek <[email protected]>
1 parent 0532480 commit fe178bb

11 files changed

+136
-3
lines changed

1.20/test/run-openshift

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../test/test_helm_nginx_imagestreams.py

1.20/test/test_helm_nginx_template.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../test/test_helm_nginx_template.py

1.22/test/run-openshift

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../test/test_helm_nginx_imagestreams.py

1.22/test/test_helm_nginx_template.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../test/test_helm_nginx_template.py
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../test/test_helm_nginx_imagestreams.py

1.24/test/test_helm_nginx_template.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../test/test_helm_nginx_template.py

1.26/test/run-openshift

-1
This file was deleted.

test/test_helm_nginx_imagestreams.py

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import os
2+
import sys
3+
4+
import pytest
5+
6+
from pathlib import Path
7+
8+
from container_ci_suite.helm import HelmChartsAPI
9+
from container_ci_suite.utils import check_variables
10+
11+
if not check_variables():
12+
print("At least one variable from IMAGE_NAME, OS, VERSION is missing.")
13+
sys.exit(1)
14+
15+
test_dir = Path(os.path.abspath(os.path.dirname(__file__)))
16+
17+
18+
class TestHelmRHELNginxImageStreams:
19+
20+
def setup_method(self):
21+
package_name = "nginx-imagestreams"
22+
path = test_dir
23+
self.hc_api = HelmChartsAPI(path=path, package_name=package_name, tarball_dir=test_dir, remote=True)
24+
self.hc_api.clone_helm_chart_repo(
25+
repo_url="https://github.com/sclorg/helm-charts", repo_name="helm-charts",
26+
subdir="charts/redhat"
27+
)
28+
29+
def teardown_method(self):
30+
self.hc_api.delete_project()
31+
32+
@pytest.mark.parametrize(
33+
"version,registry",
34+
[
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"),
41+
],
42+
)
43+
def test_package_imagestream(self, version, registry):
44+
assert self.hc_api.helm_package()
45+
assert self.hc_api.helm_installation()
46+
assert self.hc_api.check_imagestreams(version=version, registry=registry)

test/test_helm_nginx_template.py

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import os
2+
import sys
3+
4+
import pytest
5+
6+
from pathlib import Path
7+
8+
from container_ci_suite.helm import HelmChartsAPI
9+
from container_ci_suite.utils import check_variables
10+
11+
if not check_variables():
12+
print("At least one variable from IMAGE_NAME, OS, VERSION is missing.")
13+
sys.exit(1)
14+
15+
test_dir = Path(os.path.abspath(os.path.dirname(__file__)))
16+
17+
18+
VERSION = os.getenv("VERSION")
19+
IMAGE_NAME = os.getenv("IMAGE_NAME")
20+
OS = os.getenv("TARGET")
21+
22+
TAGS = {
23+
"rhel8": "-ubi8",
24+
"rhel9": "-ubi9"
25+
}
26+
TAG = TAGS.get(OS, None)
27+
28+
29+
class TestHelmNginxTemplate:
30+
31+
def setup_method(self):
32+
package_name = "nginx-template"
33+
path = test_dir
34+
self.hc_api = HelmChartsAPI(path=path, package_name=package_name, tarball_dir=test_dir, remote=True)
35+
self.hc_api.clone_helm_chart_repo(
36+
repo_url="https://github.com/sclorg/helm-charts", repo_name="helm-charts",
37+
subdir="charts/redhat"
38+
)
39+
40+
def teardown_method(self):
41+
self.hc_api.delete_project()
42+
43+
def test_curl_connection(self):
44+
if self.hc_api.oc_api.shared_cluster:
45+
pytest.skip("Do NOT test on shared cluster")
46+
new_version = VERSION
47+
if "micro" in VERSION:
48+
new_version = VERSION.replace("-micro", "")
49+
self.hc_api.package_name = "nginx-imagestreams"
50+
assert self.hc_api.helm_package()
51+
assert self.hc_api.helm_installation()
52+
self.hc_api.package_name = "nginx-template"
53+
assert self.hc_api.helm_package()
54+
assert self.hc_api.helm_installation(
55+
values={
56+
"nginx_version": f"{new_version}{TAG}",
57+
"namespace": self.hc_api.namespace
58+
}
59+
)
60+
expected_str = "Welcome to your static nginx application on OpenShift"
61+
assert self.hc_api.is_s2i_pod_running(pod_name_prefix="nginx-example")
62+
assert self.hc_api.test_helm_curl_output(
63+
route_name="nginx-example",
64+
expected_str=expected_str
65+
)
66+
67+
def test_helm_connection(self):
68+
self.hc_api.package_name = "nginx-imagestreams"
69+
new_version = VERSION
70+
if "micro" in VERSION:
71+
new_version = VERSION.replace("-micro", "")
72+
assert self.hc_api.helm_package()
73+
assert self.hc_api.helm_installation()
74+
self.hc_api.package_name = "nginx-template"
75+
assert self.hc_api.helm_package()
76+
assert self.hc_api.helm_installation(
77+
values={
78+
"nginx_version": f"{new_version}{TAG}",
79+
"namespace": self.hc_api.namespace
80+
}
81+
)
82+
expected_str = "Welcome to your static nginx application on OpenShift"
83+
assert self.hc_api.is_s2i_pod_running(pod_name_prefix="nginx-example")
84+
assert self.hc_api.test_helm_chart(expected_str=[expected_str])

0 commit comments

Comments
 (0)