
* update all READMEs with notices about the name change * update changelog for 0.24 * bump crate versions to 0.24 * update version notice information * update readmes to back reference trust-dns * rename all crates to hickory counterparts * replace all Trust-DNS references in code and comments with Hickory DNS * rename all Trust-DNS references to Hickory DNS in non-code * rename all trust-dns-resolver references to hickory-resolver * rename all trust-dns-client references to hickory-client * rename all trust-dns-proto references to hickory-proto * rename all trust-dns-server references to hickory-server * rename all trust-dns-compatibility references to hickory-compatability * rename all trust-dns-integration references to hickory-integration * rename all trust-dns-util references to hickory-util * Update MIT licenses to reference Hickory DNS * update all trust-dns references to hickory-dns * update all bluejekyll github references to hickorydns org * Update name in Changelog * make sure hickory-dns logs during tests * add changelogs for recent main additions * fix references to trust-dns and hickory in architecture * update a few trust-dns references in READMEs * fixup some dangling trust_dns references * replace fka with formerly in change log * replace all hickoydns org references to hickory-dns * replace all http links with https * update logos * update hickorydns to hickory-dns for all other org references * fix Notices of Trust-DNS to Hickory in each Readme
163 lines
4.5 KiB
Rust
163 lines
4.5 KiB
Rust
use std::str::FromStr;
|
|
|
|
use tokio::runtime::Runtime;
|
|
|
|
use hickory_proto::rr::{rdata::CNAME, Name, RData, Record, RecordType};
|
|
use hickory_server::{
|
|
authority::{Authority, ZoneType},
|
|
store::in_memory::InMemoryAuthority,
|
|
};
|
|
|
|
#[test]
|
|
fn test_cname_loop() {
|
|
let runtime = Runtime::new().expect("failed to create Tokio Runtime");
|
|
let mut auth = InMemoryAuthority::empty(
|
|
Name::from_str("example.com.").unwrap(),
|
|
ZoneType::Primary,
|
|
false,
|
|
);
|
|
|
|
auth.upsert_mut(
|
|
Record::from_rdata(
|
|
Name::from_str("foo.example.com.").unwrap(),
|
|
300,
|
|
RData::CNAME(CNAME(Name::from_str("foo.example.com.").unwrap())),
|
|
),
|
|
0,
|
|
);
|
|
|
|
auth.upsert_mut(
|
|
Record::from_rdata(
|
|
Name::from_str("bar.example.com.").unwrap(),
|
|
300,
|
|
RData::CNAME(CNAME(Name::from_str("foo.example.com.").unwrap())),
|
|
),
|
|
0,
|
|
);
|
|
|
|
auth.upsert_mut(
|
|
Record::from_rdata(
|
|
Name::from_str("baz.example.com.").unwrap(),
|
|
300,
|
|
RData::CNAME(CNAME(Name::from_str("boz.example.com.").unwrap())),
|
|
),
|
|
0,
|
|
);
|
|
|
|
auth.upsert_mut(
|
|
Record::from_rdata(
|
|
Name::from_str("boz.example.com.").unwrap(),
|
|
300,
|
|
RData::CNAME(CNAME(Name::from_str("biz.example.com.").unwrap())),
|
|
),
|
|
0,
|
|
);
|
|
|
|
auth.upsert_mut(
|
|
Record::from_rdata(
|
|
Name::from_str("biz.example.com.").unwrap(),
|
|
300,
|
|
RData::CNAME(CNAME(Name::from_str("baz.example.com.").unwrap())),
|
|
),
|
|
0,
|
|
);
|
|
|
|
let mut lookup = runtime
|
|
.block_on(auth.lookup(
|
|
&Name::from_str("foo.example.com.").unwrap().into(),
|
|
RecordType::A,
|
|
Default::default(),
|
|
))
|
|
.unwrap();
|
|
|
|
let records: Vec<&Record> = lookup.iter().collect();
|
|
assert_eq!(records.len(), 1);
|
|
let record = records[0];
|
|
assert_eq!(record.name(), &Name::from_str("foo.example.com.").unwrap());
|
|
assert_eq!(
|
|
record.data(),
|
|
Some(&RData::CNAME(CNAME(
|
|
Name::from_str("foo.example.com.").unwrap()
|
|
)))
|
|
);
|
|
|
|
assert!(
|
|
lookup.take_additionals().is_none(),
|
|
"Should be no additional records."
|
|
);
|
|
|
|
let mut lookup = runtime
|
|
.block_on(auth.lookup(
|
|
&Name::from_str("bar.example.com.").unwrap().into(),
|
|
RecordType::A,
|
|
Default::default(),
|
|
))
|
|
.unwrap();
|
|
|
|
let records: Vec<&Record> = lookup.iter().collect();
|
|
assert_eq!(records.len(), 1);
|
|
let record = records[0];
|
|
assert_eq!(record.name(), &Name::from_str("bar.example.com.").unwrap());
|
|
assert_eq!(
|
|
record.data(),
|
|
Some(&RData::CNAME(CNAME(
|
|
Name::from_str("foo.example.com.").unwrap()
|
|
)))
|
|
);
|
|
|
|
let additionals = lookup
|
|
.take_additionals()
|
|
.expect("Should be additional records");
|
|
let additionals: Vec<&Record> = additionals.iter().collect();
|
|
assert_eq!(additionals.len(), 1);
|
|
let record = additionals[0];
|
|
assert_eq!(record.name(), &Name::from_str("foo.example.com.").unwrap());
|
|
assert_eq!(
|
|
record.data(),
|
|
Some(&RData::CNAME(CNAME(
|
|
Name::from_str("foo.example.com.").unwrap()
|
|
)))
|
|
);
|
|
|
|
let mut lookup = runtime
|
|
.block_on(auth.lookup(
|
|
&Name::from_str("baz.example.com.").unwrap().into(),
|
|
RecordType::A,
|
|
Default::default(),
|
|
))
|
|
.unwrap();
|
|
|
|
let records: Vec<&Record> = lookup.iter().collect();
|
|
assert_eq!(records.len(), 1);
|
|
let record = records[0];
|
|
assert_eq!(record.name(), &Name::from_str("baz.example.com.").unwrap());
|
|
assert_eq!(
|
|
record.data(),
|
|
Some(&RData::CNAME(CNAME(
|
|
Name::from_str("boz.example.com.").unwrap()
|
|
)))
|
|
);
|
|
|
|
let additionals = lookup
|
|
.take_additionals()
|
|
.expect("Should be additional records");
|
|
let additionals: Vec<&Record> = additionals.iter().collect();
|
|
assert_eq!(additionals.len(), 2);
|
|
let record = additionals[0];
|
|
assert_eq!(record.name(), &Name::from_str("boz.example.com.").unwrap());
|
|
assert_eq!(
|
|
record.data(),
|
|
Some(&RData::CNAME(CNAME(
|
|
Name::from_str("biz.example.com.").unwrap()
|
|
)))
|
|
);
|
|
let record = additionals[1];
|
|
assert_eq!(record.name(), &Name::from_str("biz.example.com.").unwrap());
|
|
assert_eq!(
|
|
record.data(),
|
|
Some(&RData::CNAME(CNAME(
|
|
Name::from_str("baz.example.com.").unwrap()
|
|
)))
|
|
);
|
|
}
|