Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion test/run-openshift-pytest
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@
#

THISDIR=$(dirname ${BASH_SOURCE[0]})
PYTHON_VERSION="3.12"
if [[ ! -f "/usr/bin/python$PYTHON_VERSION" ]]; then
PYTHON_VERSION="3.13"
fi

cd "${THISDIR}" && python3.12 -m pytest -s -rA --showlocals -vv test_httpd*.py
cd "${THISDIR}" && python3.12 -m pytest -s -rA --showlocals -vv test_ocp_*.py
11 changes: 7 additions & 4 deletions test/test_container_httpd.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ def test_dockerfiles(self, dockerfile):
assert self.app.test_app_dockerfile()
cip = self.app.get_cip()
assert cip
assert self.app.test_response(url=cip, expected_code=200, expected_output="Welcome to your static httpd application on OpenShift")
assert self.app.test_response(
url=f"http://{cip}",
expected_output="Welcome to your static httpd application on OpenShift"
)

@pytest.mark.parametrize(
"mpm_config",
Expand All @@ -67,7 +70,7 @@ def test_mpm_config(self, mpm_config):
# Let's check that server really response HTTP-403
# See function here: in test/run `_run_mpm_config_test`
# https://github.com/sclorg/httpd-container/blob/master/test/run#L97
assert self.app.test_response(url=cip, port=8080, expected_code=403)
assert self.app.test_response(url=f"http://{cip}", expected_code=403)
logs = self.app.get_logs(cid_file_name=cid_name)
assert re.search(f"mpm_{mpm_config}:notice.*resuming normal operations", logs)

Expand All @@ -86,7 +89,7 @@ def test_log_to_data_volume(self):
container_args=f"-e HTTPD_LOG_TO_VOLUME=1 --user 0 -v {data_dir}:/var/log/httpd"
)
cip = self.app.get_cip(cid_file_name="test_log_dir")
assert self.app.test_response(url=cip, port=8080, expected_code=403)
assert self.app.test_response(url=f"http://{cip}", expected_code=403)
assert ContainerTestLibUtils.check_files_are_present(
dir_name=data_dir, file_name_to_check=[
"access_log",
Expand All @@ -113,4 +116,4 @@ def test_data_volume(self):
)
cip = self.app.get_cip(cid_file_name="doc_root")
assert cip
assert self.app.test_response(url=cip, port=8080, expected_code=200, expected_output="hello")
assert self.app.test_response(url=f"http://{cip}", expected_output="hello")
8 changes: 3 additions & 5 deletions test/test_container_httpd_s2i.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ def test_run_pre_init_test(self):
cip = self.s2i_app.get_cip(cid_file_name=self.s2i_app.app_name)
assert cip
assert self.s2i_app.test_response(
url=cip,
expected_code=200,
url=f"http://{cip}",
expected_output="This content was replaced by pre-init script."
)

Expand All @@ -59,8 +58,7 @@ def test_sample_app(self):
assert cip
response = "This is a sample s2i application with static content."
assert self.s2i_app.test_response(
url=cip,
expected_code=200,
url=f"http://{cip}",
expected_output=response
)
assert self.s2i_app.test_response(
Expand Down Expand Up @@ -135,7 +133,7 @@ def test_self_cert_test(self):
assert self.s2i_app.create_container(cid_file_name=self.s2i_app.app_name, container_args="--user 1000")
cip = self.s2i_app.get_cip(cid_file_name=self.s2i_app.app_name)
assert cip
assert self.s2i_app.test_response(url=cip, expected_code=200, expected_output="SSL test works")
assert self.s2i_app.test_response(url=f"http://{cip}", expected_output="SSL test works")
assert self.s2i_app.test_response(url=f"https://{cip}", port=8443, expected_output="SSL test works")
server_cmd = f"openssl s_client -showcerts -servername {cip} -connect {cip}:8443 2>/dev/null"
server_output = ContainerTestLibUtils.run_command(cmd=server_cmd)
Expand Down