refactor: simplify upstream-path test — reuse pool mutex, drop narrating comment

This commit is contained in:
Razvan Dimescu
2026-04-14 18:26:45 +03:00
parent e0e0f50838
commit ebb2a5db39

View File

@@ -1256,9 +1256,6 @@ mod tests {
#[tokio::test] #[tokio::test]
async fn pipeline_default_pool_reports_upstream_path() { async fn pipeline_default_pool_reports_upstream_path() {
// No forwarding rule matches — query falls through to the default
// [upstream] pool. Path must be reported as Upstream (not Forwarded)
// so operators can distinguish [[forwarding]] hits from pool traffic.
let mut upstream_resp = DnsPacket::new(); let mut upstream_resp = DnsPacket::new();
upstream_resp.header.response = true; upstream_resp.header.response = true;
upstream_resp.header.rescode = ResultCode::NOERROR; upstream_resp.header.rescode = ResultCode::NOERROR;
@@ -1269,11 +1266,11 @@ mod tests {
}); });
let upstream_addr = crate::testutil::mock_upstream(upstream_resp).await; let upstream_addr = crate::testutil::mock_upstream(upstream_resp).await;
let mut ctx = crate::testutil::test_ctx().await; let ctx = crate::testutil::test_ctx().await;
ctx.upstream_pool = std::sync::Mutex::new(crate::forward::UpstreamPool::new( ctx.upstream_pool
vec![Upstream::Udp(upstream_addr)], .lock()
vec![], .unwrap()
)); .set_primary(vec![Upstream::Udp(upstream_addr)]);
let ctx = Arc::new(ctx); let ctx = Arc::new(ctx);
let (resp, path) = resolve_in_test(&ctx, "example.com", QueryType::A).await; let (resp, path) = resolve_in_test(&ctx, "example.com", QueryType::A).await;