fix(targets): accept both DnsFailure and Unreachable in macOS DNS test (#5138)

On macOS with DNS interception services, .invalid TLD domains resolve
to an interception address (e.g. 198.18.16.173) instead of failing DNS
resolution. The health probe then classifies the error as Unreachable
rather than DnsFailure. Accept both outcomes since both are correct
non-reachable error classifications.
This commit is contained in:
Zhengchao An
2026-07-23 03:02:47 +08:00
committed by GitHub
parent 05d4480f08
commit 6e88ab2a25
+7 -1
View File
@@ -936,7 +936,13 @@ mod tests {
let health = probe_health_url(&client, &url).await;
assert_eq!(health.state, TargetHealthState::Error);
assert_eq!(health.reason, TargetHealthReason::DnsFailure);
// On systems with DNS interception (common on macOS), `.invalid` may resolve
// to an interception address, producing `Unreachable` instead of `DnsFailure`.
assert!(
matches!(health.reason, TargetHealthReason::DnsFailure | TargetHealthReason::Unreachable),
"expected DnsFailure or Unreachable, got {:?}",
health.reason
);
}
#[tokio::test(start_paused = true)]