Skip to content

Commit a9ebfe9

Browse files
committed
add test qtype TSIG inner_lookup in async_resolver
1 parent faa9131 commit a9ebfe9

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/async_resolver.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,28 @@ mod async_resolver_test {
616616
assert!(matches!(hinfo_rdata, Rdata::HINFO(_hinfo_rdata)))
617617
}
618618
}
619+
620+
#[tokio::test]
621+
async fn inner_lookup_qtype_tsig() {
622+
// Create a new resolver with default values
623+
let mut resolver = AsyncResolver::new(ResolverConfig::default());
624+
let domain_name = DomainName::new_from_string("example.com".to_string());
625+
let qtype = Qtype::TSIG;
626+
let record_class = Qclass::IN;
627+
let response = resolver.inner_lookup(domain_name,qtype,record_class).await;
628+
629+
let response = match response {
630+
Ok(val) => val,
631+
Err(error) => panic!("Error in the response: {:?}", error),
632+
};
633+
//analize if the response has the correct type according with the qtype
634+
let answers = response.get_answer();
635+
for answer in answers {
636+
let tsig_rdata = answer.get_rdata();
637+
// Check if the answer is TSIG type
638+
assert!(matches!(tsig_rdata, Rdata::TSIG(_tsig_rdata)))
639+
}
640+
}
619641
#[tokio::test]
620642
async fn inner_lookup_ns() {
621643
// Create a new resolver with default values

0 commit comments

Comments
 (0)