Skip to content

Commit

Permalink
add test qtype TSIG inner_lookup in async_resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
konegoro committed Dec 21, 2023
1 parent faa9131 commit a9ebfe9
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/async_resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,28 @@ mod async_resolver_test {
assert!(matches!(hinfo_rdata, Rdata::HINFO(_hinfo_rdata)))
}
}

#[tokio::test]
async fn inner_lookup_qtype_tsig() {
// Create a new resolver with default values
let mut resolver = AsyncResolver::new(ResolverConfig::default());
let domain_name = DomainName::new_from_string("example.com".to_string());
let qtype = Qtype::TSIG;
let record_class = Qclass::IN;
let response = resolver.inner_lookup(domain_name,qtype,record_class).await;

let response = match response {
Ok(val) => val,
Err(error) => panic!("Error in the response: {:?}", error),
};
//analize if the response has the correct type according with the qtype
let answers = response.get_answer();
for answer in answers {
let tsig_rdata = answer.get_rdata();
// Check if the answer is TSIG type
assert!(matches!(tsig_rdata, Rdata::TSIG(_tsig_rdata)))
}
}
#[tokio::test]
async fn inner_lookup_ns() {
// Create a new resolver with default values
Expand Down

0 comments on commit a9ebfe9

Please sign in to comment.