Files
2026-11-23 09:31:05 +01:00

53 lines
7.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Tests and results
All results below were produced by actually running the commands (2026-11-21, Rust 1.97.0,
Linux x86_64 container with 2 vCPUs).
## Acceptance commands
| Command | Result |
|---|---|
| `cargo fmt --all -- --check` | pass |
| `cargo clippy --workspace --all-targets --all-features -- -D warnings` | pass (0 warnings) |
| `cargo test --workspace --all-features` | pass – see counts below |
| `cargo build --workspace --release` | pass |
| `./dev.sh e2e` (real `dig`/`host`/`nslookup`, two processes) | not run yet |
## Test inventory
| Suite | What it covers |
|---|---|
| `dns-core` unit (20) | RFC 1982 serials + strategies, IDN names, zone file parse/emit incl. DNSKEY/RRSIG/NSEC/NSEC3/NSEC3PARAM/RFC 3597 round trip, TSIG request/response + multi-message chain with unsigned intermediates, UDP truncation, FORMERR, DNSSEC sign/verify/DS/tamper/expiry, NSEC logic, NSEC3 hash (RFC 5155 vector), HTTP parsing |
| `dns-config` unit (16) | sample config, unknown-field error with line, error paths, ENV/CLI precedence, open-resolver warning, upstream syntax, durations, includes, **BIND key files** (comments, multi-line secrets, errors with line numbers), **`update_policy`** rules (BIND strings and mappings, invalid rules), zone paths with `..` before the data directory exists, `hosts` section (missing file warning, invalid domain) |
| `dns-cli` unit (4) | **`zone create`**: zone with glue from `--ip`, external + in-zone name servers, mailbox escaping, missing glue error, files written + loaded by the config, no overwrite without `--force` |
| `dns-server` unit (13) | **hosts files** (names/aliases/comments, link-local zone index, NODATA for other types, PTR from the first name and line, `domain` for bare names, TTL, reload on change), query coalescing (50 identical → 1 resolution, cancelled leader releases waiters), **TLS certificate reload** (new pair picked up, broken pair rejected), **encoded-answer cache** (ID/0x20 case/TTL patching, profile/DO/name separation, generation and age invalidation, TTL 0 not cached, only plain queries – no TSIG, opcodes or trailing data, bounded memory) |
| `dns-authoritative` unit (13) | moving secondary copies and signed zones from pre-0.1.2 locations, lookup: positive/additional/case, NODATA/NXDOMAIN/ENT, CNAME chains + loops, wildcards, delegation/glue/DS at cut, validation errors, diff/apply, lint, journal chain/persistence/gap, AXFR chunking/framing, IXFR incremental/up-to-date/fallback/wrong base, zone signing (every RRset verifies, no glue/delegation signatures, NSEC chain) |
| `dns-cache` (7), `dns-policy` (5), `dns-forwarder` (2), `dns-recursive` (1), `dns-metrics` (1), `dns-tools` (3) | TTL clamp, negative caching, LRU/eviction, rank, namespaces; rules (exact/suffix/wildcard/regex/hosts), allow > block, rate limit + slip + /56, local-only, views; strategies, circuit breaker, failover; root hints; Prometheus output; dig argument parsing |
| `dns-server/tests/authoritative.rs` (6) | AA answers, negative TTL, wildcard, referral, MX additional, REFUSED, TCP, FORMERR; AXFR requires TSIG+ACL, wrong key → NOTAUTH, AXFR over UDP refused; **primary + secondary**: initial AXFR, change → NOTIFY → **IXFR**, unauthorised NOTIFY refused, restart of the secondary with the primary down serves the persisted copy; **EXPIRE → SERVFAIL**; **DDNS** unsigned refused, signed applied, prerequisites (YXDOMAIN), RRset delete, audit; **`update_policy`** with keys from an included BIND key file (granted name/type, wrong type/name/key/unsigned refused, wildcard strictly below), **IP-only updates** (`allow_update`) |
| `dns-server/tests/resolver.rs` (3) | **iterative resolution from a local root → TLD → authoritative fixture** (no Internet): A, cross-zone CNAME, glueless NS, QNAME minimisation over ENTs, NXDOMAIN/NODATA with SOA, non-existent TLD, cache hit without upstream queries, TCP, REFUSED for a client outside the ACL with **no upstream query**, local-only names never sent out; **hybrid** node: primary + secondary + forward zone + recursion + block list with **no leak** of private names to the root; **forwarder failover**, hot reload, invalid reload rolled back |
| `dns-server/tests/hosts.rs` (3) | **hosts files** in front of a forwarder: A/AAAA/PTR/NODATA, `domain`, hosts win over a local zone and the upstream, other names forwarded, edits and a file created later picked up without reload, no answers for clients outside `recursion.allowed_clients`, glob + config reload |
| `dns-server/tests/dnssec.rs` (2) | signed root/TLD/zone fixture: RRSIG with DO only, NSEC proofs; validating resolver: **secure** A (AD), secure CNAME chain, validated NXDOMAIN and NODATA, wildcard proof, **insecure** delegation (no AD), **bogus** → SERVFAIL, CD=1 returns data; signed zone change re-signs, source stays unsigned, restart reuses signatures |
| `dns-server/tests/transport.rs` (3 + 1 manual) | DoT query, 20 concurrent DoT connections, untrusted CA and wrong name rejected; DoH POST/GET, 404/405/400/415/413 (no hanging connection); **DoH over HTTP/2** – 50 concurrent GET/POST multiplexed, h2 negotiated; **pooled DoT** reuse; **secure forwarder** plain DNS → DoT/DoH upstream with private CA; manual `measure_pooled_vs_one_shot` |
| `dns-server/tests/performance.rs` (3) | coalescing of 40 identical cache misses into 1 upstream query, SO_REUSEPORT group on one port answering, **answer cache**: hit with other letter case echoes the client's spelling, DDNS change visible immediately, UDP answer stays truncated while TCP is complete, reload invalidates |
| `dns-server/tests/robustness.rs` (1) | 30 000 random + mutated packets through the handler (UDP and TCP paths), random zone/config text – no panic, no hang, server still answers |
| `dns-api/tests/api.rs` (1) | 401/403 roles, record add with ETag, If-Match 412, update, validation 400, filtering/pagination, zone create/delete (409 for config zones), reload, cache flush, stats, audit, OpenAPI |
| `dns-tools/tests/cli.rs` (1) | `ed` normal/+short/--json/NXDOMAIN/AXFR, `eh`, `ens`, `eptr --json`, `ezone` ok + broken zone exit 1, `econf`, `ediff`, usage error exit 1, timeout exit 9 |
## Load (indicative)
`ebench 127.0.0.1:5353 -n www.example.com --qps 0 --duration 10s -c 50` against
`easydns` (release) on the same 2-vCPU container (generator and server share the CPUs):
| Scenario | QPS | Lost | p50 | p95 | p99 | RSS |
|---|---|---|---|---|---|---|
| authoritative A over UDP, unthrottled, 50 workers | 54 595 | 0 % | 0.87 ms | 1.43 ms | 1.89 ms | 13 MB |
| fixed 1 000 QPS, 20 workers | 1 000 | 0 % | 0.53 ms | 0.74 ms | 0.90 ms | |
After the SO_REUSEPORT/sharding changes (0.1.1), same setup: 59 400 – 60 100 QPS,
p99 1.74 – 1.76 ms, RSS 12.3 MB (two UDP sockets on 2 vCPUs); see docs/performance.md.
`tests/performance.rs` checks that a burst of 40 identical cache misses costs one
upstream query and that every socket of the UDP group answers.
10k/50k QPS targets are reached for authoritative traffic on this hardware; 100k+ and
long-running soak tests (leaks, task/FD growth) have not been run yet – see KNOWN_ISSUES.md.