Skip to content
Merged
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
14 changes: 4 additions & 10 deletions webhook_server/tests/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,26 +708,20 @@ def test_get_logger_with_params_multiprocess_rotation_concurrency(self, tmp_path
ordered_files = [*backup_paths, base_log]
line_pattern = re.compile(r"^(\S+)\s+.*worker=(\d+)\s+(?:msg|pad)=(\d+)")
last_msg_by_worker: dict[int, int] = {}
file_ts_bounds: list[tuple[datetime, datetime]] = []

for log_path in ordered_files:
timestamps: list[datetime] = []
for line in log_path.read_text(encoding="utf-8").splitlines():
lines = log_path.read_text(encoding="utf-8").splitlines()
assert lines
for line in lines:
match = line_pattern.match(line)
assert match is not None, f"Unparseable or interleaved log line in {log_path}: {line!r}"
ts_str, worker_str, seq_str = match.groups()
timestamps.append(datetime.fromisoformat(ts_str))
datetime.fromisoformat(ts_str)
if " msg=" in line:
w_id = int(worker_str)
seq = int(seq_str)
assert seq > last_msg_by_worker.get(w_id, -1)
last_msg_by_worker[w_id] = seq
assert timestamps
file_ts_bounds.append((min(timestamps), max(timestamps)))

for earlier, later in zip(file_ts_bounds, file_ts_bounds[1:], strict=False):
assert earlier[0] <= later[0]
assert earlier[1] <= later[1]
Comment thread
qodo-code-review[bot] marked this conversation as resolved.
Resolved
finally:
for worker in workers:
if worker.is_alive():
Expand Down