fix: test: Avoid rndc loadkeys race in checkds system test

Address a `checkds` test race condition.

Example failure:

```
________________ test_checkds[incomplete.yes.dspublish.ns2-4-5] ________________
[gw3] linux -- Python 3.13.5 /usr/bin/python3
/builds/isc-projects/bind9/bin/tests/system/checkds/tests_checkds.py:451: in test_checkds
    keystate_check(ns2, params.zone, params.expected_parent_state)
/builds/isc-projects/bind9/bin/tests/system/checkds/tests_checkds.py:183: in keystate_check
    assert val == 0
E   AssertionError: assert '20260528103555 (Thu May 28 10:35:55 2026)' == 0
```

https://gitlab.isc.org/isc-projects/bind9/-/jobs/7497509

Merge branch 'nicki/fix-checkds-loadkeys-race' into 'main'

See merge request isc-projects/bind9!12138
This commit is contained in:
Nicki Křížek 2026-06-01 13:33:50 +02:00
commit ab9c63b057

View file

@ -435,16 +435,14 @@ def test_checkds(ns2, ns9, params):
# Wait until the provided zone is signed and then verify its DNSSEC data.
zone_check(ns9, params.zone)
# Wait up to 10 seconds until all the expected log lines are found in the
# log file for the provided server. Rekey every second if necessary.
time_remaining = 10
for log_string in params.logs_to_wait_for:
line = f"zone {params.zone}/IN (signed): checkds: {log_string}"
while line not in ns9.log:
ns9.rndc(f"loadkeys {params.zone}")
time_remaining -= 1
assert time_remaining, f'Timed out waiting for "{log_string}" to be logged'
time.sleep(1)
# Trigger a single checkds round and wait for all expected parental-
# agent response lines.
patterns = [
f"zone {params.zone}/IN (signed): checkds: {s}" for s in params.logs_to_wait_for
]
with ns9.watch_log_from_start() as watcher:
ns9.rndc(f"loadkeys {params.zone}")
watcher.wait_for_all(patterns)
# Check whether key states on the parent server provided match
# expectations.