Skip to content

Commit bd46f56

Browse files
committed
NO-JIRA: chore(tests/containers): report on nginx error messages in logs
1 parent 4a7c9f9 commit bd46f56

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
@@ -149,7 +149,7 @@ def _connect(self, container_host: str | None = None, container_port: int | None
149149
host = container_host or self.get_container_host_ip()
150150
port = container_port or self.get_exposed_port(self.port)
151151
try:
152-
# if we did not enable cookies support here, with RStudio we'd end up looping and getting
152+
# if we did not enable cookie support here, with RStudio we'd end up looping and getting
153153
# HTTP 302 (i.e. `except urllib.error.HTTPError as e: assert e.code == 302`) every time
154154
cookie_jar = http.cookiejar.CookieJar()
155155
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cookie_jar))
@@ -194,8 +194,15 @@ def skip_if_not_workbench_image(image: str) -> docker.models.images.Image:
194194

195195
def grab_and_check_logs(subtests: pytest_subtests.SubTests, container: WorkbenchContainer) -> None:
196196
# Here is a list of blocked keywords we don't want to see in the log messages during the container/workbench
197-
# startup (e.g. log messages from Jupyter IDE, code-server IDE or RStudio IDE).
198-
blocked_keywords = ["Error", "error", "Warning", "warning", "Failed", "failed", "[W ", "[E ", "Traceback"]
197+
# startup (e.g., log messages from Jupyter IDE, code-server IDE or RStudio IDE).
198+
blocked_keywords = [
199+
"Error", "error", "Warning", "warning", "Failed", "failed",
200+
"[W ", "[E ",
201+
# https://docs.nginx.com/nginx/admin-guide/monitoring/logging/
202+
"[warn] ", "[error] ", "[crit] ", "[alert] ", "[emerg] ",
203+
# https://docs.python.org/3/tutorial/errors.html#exceptions
204+
"Traceback",
205+
]
199206
# Here is a list of allowed messages that match some block keyword from the list above, but we allow them
200207
# for some reason.
201208
allowed_messages = [
@@ -205,8 +212,8 @@ def grab_and_check_logs(subtests: pytest_subtests.SubTests, container: Workbench
205212
"connect() failed (111: Connection refused) while connecting to upstream, client",
206213
]
207214

208-
# Let's wait couple of seconds to give a chance to log eventual extra startup messages just to be sure we don't
209-
# miss anytihng important in this test.
215+
# Let's wait a couple of seconds to give a chance to log eventual extra startup messages just to be sure we don't
216+
# miss anything important in this test.
210217
time.sleep(3)
211218

212219
stdout, stderr = container.get_logs()

0 commit comments

Comments
 (0)