Skip to content

Commit 3c581b5

Browse files
Merge pull request #916 from jiridanek/jd_nginx_errors
NO-JIRA: chore(tests/containers): report on nginx error messages in logs
2 parents 54ca634 + bd46f56 commit 3c581b5

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

tests/containers/workbenches/workbench_image_test.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def _connect(self, container_host: str | None = None, container_port: int | None
150150
host = container_host or self.get_container_host_ip()
151151
port = container_port or self.get_exposed_port(self.port)
152152
try:
153-
# if we did not enable cookies support here, with RStudio we'd end up looping and getting
153+
# if we did not enable cookie support here, with RStudio we'd end up looping and getting
154154
# HTTP 302 (i.e. `except urllib.error.HTTPError as e: assert e.code == 302`) every time
155155
cookie_jar = http.cookiejar.CookieJar()
156156
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cookie_jar))
@@ -181,8 +181,15 @@ def start(self, wait_for_readiness: bool = True) -> WorkbenchContainer:
181181

182182
def grab_and_check_logs(subtests: pytest_subtests.SubTests, container: WorkbenchContainer) -> None:
183183
# Here is a list of blocked keywords we don't want to see in the log messages during the container/workbench
184-
# startup (e.g. log messages from Jupyter IDE, code-server IDE or RStudio IDE).
185-
blocked_keywords = ["Error", "error", "Warning", "warning", "Failed", "failed", "[W ", "[E ", "Traceback"]
184+
# startup (e.g., log messages from Jupyter IDE, code-server IDE or RStudio IDE).
185+
blocked_keywords = [
186+
"Error", "error", "Warning", "warning", "Failed", "failed",
187+
"[W ", "[E ",
188+
# https://docs.nginx.com/nginx/admin-guide/monitoring/logging/
189+
"[warn] ", "[error] ", "[crit] ", "[alert] ", "[emerg] ",
190+
# https://docs.python.org/3/tutorial/errors.html#exceptions
191+
"Traceback",
192+
]
186193
# Here is a list of allowed messages that match some block keyword from the list above, but we allow them
187194
# for some reason.
188195
allowed_messages = [
@@ -192,8 +199,8 @@ def grab_and_check_logs(subtests: pytest_subtests.SubTests, container: Workbench
192199
"connect() failed (111: Connection refused) while connecting to upstream, client",
193200
]
194201

195-
# Let's wait couple of seconds to give a chance to log eventual extra startup messages just to be sure we don't
196-
# miss anytihng important in this test.
202+
# Let's wait a couple of seconds to give a chance to log eventual extra startup messages just to be sure we don't
203+
# miss anything important in this test.
197204
time.sleep(3)
198205

199206
stdout, stderr = container.get_logs()

0 commit comments

Comments
 (0)