Skip to content

Commit d184522

Browse files
committed
Make test_logging correctly handle case where threadname has space
Occasionally, the first logging message from a VM would be from a vcpu thread, which is named `fc_vpu 0` or similar. The previous logic would then split on spaces, assuming that the "tag" part of the message doesnt contain a space. Now, it doesn't tear apart the tag anymore if there's a space in it, meaning we no longer get spurious failures in the above case. Signed-off-by: Patrick Roy <[email protected]>
1 parent 83514fe commit d184522

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tests/integration_tests/functional/test_logging.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def check_log_message_format(log_str, instance_id, level, show_level, show_origi
4848
e.g. with THREAD NAME as TN
4949
`2018-09-09T12:52:00.123456789 [MYID:TN:WARN:/path/to/file.rs:52] warning`
5050
"""
51-
(timestamp, tag, _) = log_str.split(" ")[:3]
51+
timestamp, tag_and_msg = log_str.split(" ", maxsplit=1)
5252
timestamp = timestamp[:-10]
5353
strptime(timestamp, "%Y-%m-%dT%H:%M:%S")
5454

@@ -58,9 +58,9 @@ def check_log_message_format(log_str, instance_id, level, show_level, show_origi
5858
pattern += ":(" + "|".join(LOG_LEVELS) + ")"
5959
if show_origin:
6060
pattern += ":([^:]+/[^:]+):([0-9]+)"
61-
pattern += "\\]"
61+
pattern += "\\].*"
6262

63-
mo = re.match(pattern, tag)
63+
mo = re.match(pattern, tag_and_msg)
6464
assert mo is not None
6565

6666
if show_level:

0 commit comments

Comments
 (0)