Skip to content

Commit faa9131

Browse files
committed
add test qtype HINFO inner_lookup in async_resolver
1 parent 3904777 commit faa9131

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
@@ -594,6 +594,28 @@ mod async_resolver_test {
594594
assert!(matches!(cname_rdata, Rdata::CNAME(_cname_rdata)))
595595
}
596596
}
597+
598+
#[tokio::test]
599+
async fn inner_lookup_qtype_hinfo() {
600+
// Create a new resolver with default values
601+
let mut resolver = AsyncResolver::new(ResolverConfig::default());
602+
let domain_name = DomainName::new_from_string("example.com".to_string());
603+
let qtype = Qtype::HINFO;
604+
let record_class = Qclass::IN;
605+
let response = resolver.inner_lookup(domain_name,qtype,record_class).await;
606+
607+
let response = match response {
608+
Ok(val) => val,
609+
Err(error) => panic!("Error in the response: {:?}", error),
610+
};
611+
//analize if the response has the correct type according with the qtype
612+
let answers = response.get_answer();
613+
for answer in answers {
614+
let hinfo_rdata = answer.get_rdata();
615+
// Check if the answer is HINFO type
616+
assert!(matches!(hinfo_rdata, Rdata::HINFO(_hinfo_rdata)))
617+
}
618+
}
597619
#[tokio::test]
598620
async fn inner_lookup_ns() {
599621
// Create a new resolver with default values

0 commit comments

Comments
 (0)