]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
new: test: Add isctest.transfer.transfer_message() helper and convert tests
authorMichal Nowak <mnowak@isc.org>
Mon, 11 May 2026 13:34:30 +0000 (15:34 +0200)
committerMichal Nowak <mnowak@isc.org>
Mon, 11 May 2026 13:34:30 +0000 (15:34 +0200)
Add a new helper function, `isctest.transfer.transfer_message()`, to
`bin/tests/system/isctest/transfer.py` that generates the log message
produced by `xfrin_log()` in `lib/dns/xfrin.c` for an incoming zone
transfer:

    transfer of '<zone>/IN' from <source_ns>#<port>: <msg>

The explicit use of `port` matches current shell system usage.

Interface
---------
    transfer_message(zone, source_ns, msg, port=None)

-  zone      - zone name without class (e.g. "example.com")
-  source_ns - IP string, or None to wildcard the source address
-  msg       - the transfer-level message
              (e.g. "Transfer status: success")
-  port      - integer source port, or None to wildcard the port number

When both source_ns and port are concrete values a plain str is returned
and `wait_for_line()` treats it as a literal substring match.  Whenever
either is `None` a compiled `re.Pattern` is returned, with the unknown part
replaced by a constrained wildcard:

-  source_ns=None, port=None      -> from .*#[0-9]+:
-  source_ns=None, port=53        -> from .*#53:
-  source_ns="1.2.3.4", port=None -> from 1.2.3.4#[0-9]+:
-  source_ns="1.2.3.4", port=N   -> "from 1.2.3.4#N:"  (plain str)

The port wildcard is [0-9]+ (not .*) because a port is always numeric.

Convert all hard-coded transfer log patterns in the Python system tests
to use transfer_message().

Notable cases:
- `mirror_root_zone`: source_ns=None (live internet, any root server),
  port=53.
- `cipher_suites`: source_ns="10.53.0.1", port=None (each zone transfers
  over a different TLS port).
- `test_under_signed_transfer`: parametrize gains a boolean xfrin_msg
  flag to distinguish messages that go through xfrin_log() from
  lower-level TSIG errors that do not.

Testing
-------
All system tests pass under `pytest -n auto`. The `mirror_root_zone`
live-internet test was also verified separately with
`CI_ENABLE_LIVE_INTERNET_TESTS=1`.

LLM usage
---------
This commit was produced in an interactive session with Claude Code
(Claude Sonnet 4.6), guided step by step by a human reviewer.

Closes #5735

Merge branch '5735-make-transfer-message-formatter' into 'main'

See merge request isc-projects/bind9!11796


Trivial merge