1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//! An address that refuses every connection and no test in this suite can
//! occupy, for the harnesses that need a connect-time failure (#115, #229).
//!
//! Included by `#[path]` from each user rather than declared in
//! `common/mod.rs`: that module is compiled into every test binary that
//! says `mod common;`, so a helper only some of them use would be
//! `dead_code` in the rest, which `-D warnings` rejects (#167, #214).
//! `REFUSED_CONNECT_BUDGET` stayed behind because only the guard-client
//! harnesses bound a call with it.
//!
//! The library's `#[cfg(test)]` tree includes this file the same way
//! (`lib.rs`): an integration-test file is out of reach for `use`, not
//! for `#[path]`, so a unit test that DIALS an unreachable upstream
//! checks the address instead of assuming it (#280).
//!
//! Where it belongs, one rule: take the probe wherever a test's client
//! actually connects to the address, because that is where a box that
//! filters port 1 instead of closing it costs a wait on the caller's
//! client timeout, and the probe spends 500 ms to name the cause here
//! rather than fail obscurely there. An address handed to a client that
//! never opens a connection has no such wait to buy out and stays a
//! bare literal; `server::tests::NO_BUGZILLA` and
//! `otel::tests::NO_COLLECTOR` are those, and point back here.
//!
//! `bugwarden-core` keeps its own copy — the private `refused_base_url`
//! in `crates/bugwarden-core/tests/guard_wiremock.rs` — because a
//! `#[path]` out of that package into this one's `tests/` reaches
//! outside the package directory and would not survive packaging.
//! Nothing but the pointer in each rustdoc pairs the two: edit one, edit
//! the other.
/// Connect-time failure nothing in this process can answer (#115, #229).
///
/// The address is `127.0.0.1:1`. Port 1 is privileged: a non-root test
/// process cannot bind it, so neither wiremock's `127.0.0.1:0` pool nor a
/// stranger racing an ephemeral port can answer this request. The
/// load-bearing assertion is `port() < 1024` — a bind-then-drop of an
/// ephemeral port fails the helper. A 500 ms TCP probe refuses to
/// return an address that accepted or timed out; the URL is built from
/// the probed socket so the two cannot drift.
///
/// Scheme and authority only: a caller needing a path (`/v1/logs` for
/// the OTLP export) appends its own.