Skip to content
This repository has been archived by the owner on Jun 21, 2024. It is now read-only.

Commit

Permalink
improve testing
Browse files Browse the repository at this point in the history
  • Loading branch information
xvello committed May 6, 2024
1 parent 61c0516 commit 4e0a546
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions hook-worker/src/dns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ mod tests {
.await
{
Ok(_) => panic!("should have failed"),
Err(err) => assert!(err.downcast_ref::<NoPublicIPv4Error>().is_some()),
Err(err) => assert!(err.is::<NoPublicIPv4Error>()),
}
}

Expand All @@ -122,16 +122,19 @@ mod tests {
}

#[tokio::test]
async fn it_propagates_unknown_domain() {
async fn it_bubbles_up_resolution_error() {
let resolver: PublicIPv4Resolver = PublicIPv4Resolver {};
match resolver
.resolve(Name::from_str("invalid.domain.unknown").unwrap())
.await
{
Ok(_) => panic!("should have failed"),
Err(err) => assert!(err
.to_string()
.contains("failed to lookup address information")),
Err(err) => {
assert!(!err.is::<NoPublicIPv4Error>());
assert!(err
.to_string()
.contains("failed to lookup address information"))
}
}
}
}

0 comments on commit 4e0a546

Please sign in to comment.