fix: DNS detection and Kea search raise on a failed read, hermetic open() test (#39, #40, #41) #42

Merged
christianmanivong merged 4 commits from fix/bugs-2026-11-02 into main 2026-11-02 08:20:46 +00:00
4 Commits
Author SHA1 Message Date
Christian Manivong 6ac7a6f6a2 refactor(dhcp): move the Kea subnet lookup into kea_reservations
driver / standard (pull_request) Successful in 15s
driver / lint (pull_request) Successful in 17s
driver / types (pull_request) Successful in 1m10s
driver / test (3.12) (pull_request) Successful in 1m17s
driver / test (3.13) (pull_request) Successful in 1m12s
driver / lowest (pull_request) Successful in 36s
driver / build (pull_request) Successful in 33s
driver / security (pull_request) Successful in 1m7s
CI / driver (pull_request) Successful in 2m56s
driver / publish (pull_request) Skipped
create_dhcp_reservation and _kea_subnet_uuid_for each walked the
searchSubnet rows for the one holding an address. Both now call the
pure subnet_containing(), which brings create_dhcp_reservation under
the complexity limit and back below its recorded length after #40;
the quality baseline records the shrunk entries.
2026-11-02 08:51:21 +01:00
Christian Manivong 96a4a139d0 fix(tests): keep the open() failure test off the network
driver / standard (pull_request) Failing after 20s
driver / lint (pull_request) Successful in 21s
driver / types (pull_request) Successful in 1m10s
driver / test (3.12) (pull_request) Successful in 1m44s
driver / test (3.13) (pull_request) Successful in 1m28s
driver / lowest (pull_request) Successful in 56s
driver / build (pull_request) Successful in 34s
driver / security (pull_request) Successful in 1m8s
CI / driver (pull_request) Failing after 3m33s
driver / publish (pull_request) Skipped
test_open_raises_connection_exception_on_error called open() on
"unreachable.invalid" unpatched, so the unit test resolved the name
through the host's resolver and depended on it failing fast. Patch
requests.Session.get to refuse the connection and check that open()
raises ConnectionException and leaves no session behind.

Closes #41
2026-11-02 08:37:58 +01:00
Christian Manivong 0f730a4b9d fix(dhcp): raise when the Kea reservation search fails
create_dhcp_reservation searched for an existing reservation so a retry
updates it, but a failed search was logged at debug level and the add
went ahead: a write based on a read that did not happen. Raise a
RuntimeError naming searchReservation before anything is written.

Closes #40
2026-11-02 08:37:06 +01:00
Christian Manivong 901df1b523 fix(dns): raise when the DNS service detection fails
_detect_active_dns caught every error from /api/core/service/search and
returned None, so get_dns_entries() reported a transient API error as an
empty list (no DNS service) and sync_dns_zone() blamed the DNS service.
Let the request error propagate; None only when the list was read and
neither Unbound nor Dnsmasq runs.

Closes #39
2026-11-02 08:35:49 +01:00