Fixed old test.

This commit is contained in:
Revertron
2026-03-20 11:38:19 +01:00
parent eb30037f53
commit eee73be58e
+12 -8
View File
@@ -592,19 +592,23 @@ mod tests {
assert_eq!(3, list.len()); assert_eq!(3, list.len());
// Check statistics for google entry // Find entries by domain name (LRU order may vary)
assert_eq!("google.com", list[1].domain); let google_entry = list.iter().find(|e| e.domain == "google.com").expect("google.com entry");
let ns1_entry = list.iter().find(|e| e.domain == "ns1.google.com").expect("ns1.google.com entry");
let foobar_entry = list.iter().find(|e| e.domain == "foobar.google.com").expect("foobar.google.com NXDOMAIN entry");
// Should have a NS record and an A record for a total of 2 record types // google.com should have a NS record and an A record for a total of 2 record types
assert_eq!(2, list[1].record_types.len()); assert_eq!(2, google_entry.record_types.len());
// Should have been hit two times for NS google.com and once for // Should have been hit two times for NS google.com and once for
// A google.com // A google.com
assert_eq!(3, list[1].hits); assert_eq!(3, google_entry.hits);
assert_eq!("ns1.google.com", list[2].domain); assert_eq!(1, ns1_entry.record_types.len());
assert_eq!(1, list[2].record_types.len()); assert_eq!(2, ns1_entry.hits);
assert_eq!(2, list[2].hits);
// foobar.google.com should be a cached NXDOMAIN with 0 hits
assert_eq!(0, foobar_entry.hits);
}; };
} }
} }