Skip to content

Commit a9b2f22

Browse files
committed
Add documentation to each tests.
Fix pre-commit issues Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
1 parent fa8277f commit a9b2f22

9 files changed

+44
-8
lines changed

test/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"rhel10": "-ubi10",
3434
}
3535

36+
3637
def skip_clear_env_tests():
3738
if VARS.OS == "rhel8" and VERSION == "8.2":
3839
skip(f"Skipping clear env tests for {VARS.VERSION} on {VARS.OS}.")

test/test_container_example_apps.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ def teardown_method(self):
112112
self.s2i_app.cleanup()
113113

114114
def test_log_output(self):
115+
"""
116+
Test checks if logging container works properly
117+
and logs contain proper output
118+
"""
115119
cid_file_name = "test-app"
116120
self.s2i_app.set_new_image(image_name=f"{VARS.IMAGE_NAME}-{cid_file_name}")
117121
assert self.s2i_app.create_container(
@@ -135,6 +139,12 @@ def test_log_output(self):
135139
assert re.search("open.*failed.*No such file or directory", logs)
136140

137141
def test_log_volume_output(self):
142+
"""
143+
Test checks if logging container works properly
144+
and logs contain proper output.
145+
The logs are mounted from host and so we check
146+
the logs in host directly
147+
"""
138148
cid_file_name = "test-app"
139149
self.s2i_app.set_new_image(image_name=f"{VARS.IMAGE_NAME}-{cid_file_name}")
140150
assert self.s2i_app.create_container(

test/test_ocp_imagestream_s2i.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from conftest import VARS
55

6-
# bash test=test_nginx_imagestream
6+
77
class TestNginxImagestreamS2I:
88

99
def setup_method(self):
@@ -16,6 +16,11 @@ def teardown_method(self):
1616
self.oc_api.delete_project()
1717

1818
def test_inside_cluster(self):
19+
"""
20+
Test checks if example nginx container
21+
works with imagestreams
22+
The example application is in directory `examples/<VERSION>/test-app
23+
"""
1924
os_name = ''.join(i for i in VARS.OS if not i.isdigit())
2025
assert self.oc_api.deploy_imagestream_s2i(
2126
imagestream_file=f"imagestreams/nginx-{os_name}.json",

test/test_ocp_imagestreams.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22

33
from conftest import VARS
44

5+
56
class TestLatestImagestreams:
67

78
def setup_method(self):
89
self.isc = ImageStreamChecker(working_dir=VARS.TEST_DIR / ".." / "..")
910

1011
def test_latest_imagestream(self):
12+
"""
13+
Test checks we have the latest imagestream in GitHub repository
14+
"""
1115
self.latest_version = self.isc.get_latest_version()
1216
assert self.latest_version != ""
1317
self.isc.check_imagestreams(self.latest_version)

test/test_ocp_local_example.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from conftest import VARS
55

66

7-
# Replacement with 'test_python_s2i_app_ex_standalone'
87
class TestNginxLocalEx:
98

109
def setup_method(self):
@@ -17,6 +16,11 @@ def teardown_method(self):
1716
self.oc_api.delete_project()
1817

1918
def test_nginx_ex_template_inside_cluster(self):
19+
"""
20+
Test checks if example nginx container
21+
works with local test-app
22+
The example application is in directory `examples/<VERSION>/test-app
23+
"""
2024
assert self.oc_api.deploy_s2i_app(
2125
image_name=VARS.IMAGE_NAME, app="test-app",
2226
context=".",

test/test_ocp_remote_example.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
from conftest import VARS
55

66

7-
# Replacement with
8-
# test_nginx_remote_example
97
class TestNginxLocalEx:
108

119
def setup_method(self):
@@ -18,8 +16,13 @@ def teardown_method(self):
1816
self.oc_api.delete_project()
1917

2018
def test_nginx_ex_template_inside_cluster(self):
19+
"""
20+
Test checks if example GitHub application `nginx-ex`
21+
works with properly
22+
The response checks expected message
23+
"""
2124
assert self.oc_api.deploy_s2i_app(
22-
image_name=VARS.IMAGE_NAME, app=f"https://github.com/sclorg/nginx-ex.git",
25+
image_name=VARS.IMAGE_NAME, app="https://github.com/sclorg/nginx-ex.git",
2326
context=".",
2427
service_name=self.template_name
2528
)

test/test_ocp_shared_helm_imagestreams.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ def teardown_method(self):
3434
],
3535
)
3636
def test_package_imagestream(self, version, registry, expected):
37+
"""
38+
Test checks if Helm imagestream are present, including deprecated
39+
"""
3740
assert self.hc_api.helm_package()
3841
assert self.hc_api.helm_installation()
3942
assert self.hc_api.check_imagestreams(version=version, registry=registry) == expected

test/test_ocp_shared_helm_template.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ def teardown_method(self):
1919
self.hc_api.delete_project()
2020

2121
def test_helm_connection(self):
22+
"""
23+
Test checks if Helm imagestream and Helm nginx template application
24+
works properly and response is as expected.
25+
"""
2226
self.hc_api.package_name = "redhat-nginx-imagestreams"
2327
assert self.hc_api.helm_package()
2428
assert self.hc_api.helm_installation()

test/test_ocp_template_example_app.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
from conftest import VARS
33

44

5-
# bash test_nginx_template_from_example_app
6-
# Replacement with 'test_python_s2i_templates'
75
class TestNginxDeployTemplate:
86

97
def setup_method(self):
@@ -13,6 +11,10 @@ def teardown_method(self):
1311
self.oc_api.delete_project()
1412

1513
def test_nginx_template_inside_cluster(self):
14+
"""
15+
Test checks if Helm imagestream and Helm perl dancer application
16+
works properly and response is as expected.
17+
"""
1618
service_name = "nginx-testing"
1719
template_url = self.oc_api.get_raw_url_for_json(
1820
container="nginx-ex", dir="openshift/templates", filename="nginx.json", branch="master"
@@ -22,7 +24,7 @@ def test_nginx_template_inside_cluster(self):
2224
template=template_url,
2325
name_in_template="nginx",
2426
openshift_args=[
25-
f"SOURCE_REPOSITORY_REF=master",
27+
"SOURCE_REPOSITORY_REF=master",
2628
f"NGINX_VERSION={VARS.VERSION}",
2729
f"NAME={service_name}"
2830
]

0 commit comments

Comments
 (0)