mlevkov commented on PR #3804:
URL: https://github.com/apache/iggy/pull/3804#issuecomment-5161229387

   Added the test, so the 3 lines are no longer uncovered.
   
   Reaching the warning requires a non-loopback address, and any non-loopback
   address that *binds* would open a port on every interface for the length of 
the
   test (on macOS that also trips the "accept incoming connections" prompt for
   unsigned test binaries). So the test uses a documentation-range address,
   `192.0.2.1:8081` (RFC 5737), which is never assignable on a real host: `init`
   emits the warning and then fails the bind.
   
   That constraint turns out to give the stronger assertion. The warning is only
   observable at all if it precedes the bind, which is exactly what an operator
   whose bind subsequently fails depends on. Both mutations fail the test:
   
   - deleting the `if is_unauthenticated_beyond_loopback(config)` block from 
`init`
   - moving it below the `TcpListener::bind`
   
   The second is the one a plain "does it warn" test would have missed.
   
   The loopback case is covered too, asserting the shipped default produces no
   warning. Warning on the default posture would be worse than not warning, 
since
   operators would learn to ignore it.
   
   Capture is via a global subscriber installed once per test binary, because a
   `warn!` is invisible to a test without one. Each test filters the captured 
lines
   by its own address, so events from tests running in parallel cannot be 
mistaken
   for each other.
   
   No production code changed in this commit: `git diff` on it is 152 
insertions and
   0 deletions, all inside `#[cfg(test)]`.
   
   `cargo test -p iggy-connectors` is 128 passing (was 126). fmt, sort, clippy
   `-D warnings`, taplo, hawkeye, typos all exit 0.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to