Skip to content

Commit

Permalink
integration tests: Fix file access in test_http_methods
Browse files Browse the repository at this point in the history
Instead of calling check_output(), we should use Site.read_file() when accessing files in a site.

Change-Id: Ic58926e0139138b687f897b9e3af79bcc3b307dd
  • Loading branch information
rene-slowenski-checkmk committed Dec 12, 2024
1 parent 00f52f2 commit 2322b59
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tests/integration/omd/test_apache.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import requests

from tests.testlib.site import Site
from tests.testlib.utils import check_output


def test_http_methods(site: Site) -> None:
Expand All @@ -23,9 +22,8 @@ def test_http_methods(site: Site) -> None:
"PROPFIND", site.internal_url, timeout=5, headers={"User-Agent": user_agent}
)
assert response.status_code == 405
apache_log_file = check_output(
["cat", site.path("var/log/apache/access_log").as_posix()], sudo=True
)

apache_log_file = site.read_file("var/log/apache/access_log")
for line in apache_log_file.splitlines():
if re.match(r'^.*"PROPFIND /\w+/check_mk/ HTTP/1.1" 405 \d+ "-" "' + user_agent, line):
return
Expand Down

0 comments on commit 2322b59

Please sign in to comment.