diff --git a/contrib/testing/README.md b/contrib/testing/README.md index b33be78..b6a4b60 100644 --- a/contrib/testing/README.md +++ b/contrib/testing/README.md @@ -32,8 +32,9 @@ one-off files in `/tmp`: configuration without committing a message. - `smtp-internal-normalization-check.py` sends only to the reserved `.invalid` namespace through trusted port 26, inspects the real Queue - routing envelope for ten sender-normalization cases, deletes every test - entry, and restores the exact SMTP configuration. + routing envelope for ten sender-normalization cases after atomically moving + each entry to the hold queue, deletes every test entry, and restores the + exact SMTP configuration. - `c-literal-length-check.py` audits manually sized string literals passed to Bongo connection I/O helpers and rejects lengths that include a trailing NUL, truncate a protocol line, or read past the literal. diff --git a/contrib/testing/smtp-internal-normalization-check.py b/contrib/testing/smtp-internal-normalization-check.py index 84c0812..666d4d2 100755 --- a/contrib/testing/smtp-internal-normalization-check.py +++ b/contrib/testing/smtp-internal-normalization-check.py @@ -239,7 +239,16 @@ def wait_envelope(baseline: set[str], expected_sender: str) -> str: raise NormalizationCheckError( f"test created multiple Queue entries: {matches!r}") if matches: - queue_id = matches[0] + held = queue("hold", matches[0], check=False) + if held.returncode: + time.sleep(0.1) + continue + queue_id = held.stdout.strip() + if not QUEUE_ID.fullmatch(queue_id) or not queue_id.startswith( + "999-" + ): + raise NormalizationCheckError( + f"invalid held Queue ID: {queue_id!r}") envelope = queue("show", queue_id, binary=True).stdout from_lines = [ line[1:].decode("utf-8", "strict").split() @@ -347,7 +356,8 @@ def main() -> int: print( "SMTP-05 PASS " f"host={HOST}:{PORT} source={SOURCE} device={DEVICE} cases=10 " - "queue-envelope=yes fcrdns=unit-tested external-boundary=yes " + "queue-envelope=yes queue-held=yes fcrdns=unit-tested " + "external-boundary=yes " "internet-delivery=no restored=yes" ) return 0