barrucadu / resolved

A simple DNS server for home networks.
https://resolved.docs.barrucadu.co.uk/
21 stars 0 forks source link

Flake test on wildcard queries for NS records in a non-authoritative zone #341

Open barrucadu opened 3 months ago

barrucadu commented 3 months ago
---- zones::types::tests::zone_insert_resolve stdout ----
thread 'zones::types::tests::zone_insert_resolve' panicked at crates/dns-types/src/zones/types.rs:831:13:
assertion `left == right` failed
  left: Some(Answer { rrs: [ResourceRecord { name: DomainName { to_dotted_string(): ";[1wcv\u{6}!\u{1a}h.&x\u{1d}||h\"\0\u{10}xqvi%{.x\u{19}\u{15}.nk,xq}\u{1c}xb&0\u{10}~\u{1b}x\u{19}\u{10}%.hu4.][.(x\u{1a}\u{1f}.\u{18}mxmv\u{17}dt$7\u{3}<\u{1e}nx3b\u{3}x.example.com." }, rtype_with_data: NS { nsdname: DomainName { to_dotted_string(): "." } }, rclass: IN, ttl: 0 }] })
 right: Some(Delegation { ns_rrs: [ResourceRecord { name: DomainName { to_dotted_string(): ";[1wcv\u{6}!\u{1a}h.&x\u{1d}||h\"\0\u{10}xqvi%{.x\u{19}\u{15}.nk,xq}\u{1c}xb&0\u{10}~\u{1b}x\u{19}\u{10}%.hu4.][.(x\u{1a}\u{1f}.\u{18}mxmv\u{17}dt$7\u{3}<\u{1e}nx3b\u{3}x.example.com." }, rtype_with_data: NS { nsdname: DomainName { to_dotted_string(): "." } }, rclass: IN, ttl: 0 }] })

Line 831 is a wildcard query:

assert_eq!(expected, zone.resolve(&rr.name, QueryType::Wildcard));

And since the inserted record is an NS record, we get a delegation rather than an answer. This is expected (and tested for, in zone_resolve_delegation), but causes a failure here. I think there are other tests with the same issue.