diff --git a/src/preflight.rs b/src/preflight.rs index ba09afa..947a38a 100644 --- a/src/preflight.rs +++ b/src/preflight.rs @@ -402,19 +402,24 @@ mod tests { /// A shadowed hostname must not be counted as a reason to expect failure. /// This is the exact case the first version got wrong. + /// + /// Asserts the hostname check itself rather than counting states across the + /// whole run: `backend_reachable` opens real sockets, so an aggregate count + /// silently asserts that THIS machine has the OpenFUT ports open. That made + /// the test pass only on the server host and fail on the game machine, which + /// is precisely where someone building the launcher runs the suite. #[test] fn a_shadowed_hostname_is_a_warning_not_a_failure() { let mut c = cfg(); c.openfut_server_host = "127.0.0.2".into(); c.ea_hostnames = vec!["localhost".into()]; - c.fifa17_tools_dir = "/nonexistent/openfut-tools".into(); - // Machine-independence: this counts warnings across every check, so the - // game dir must not be a real one. A box with a hook deployed (the game - // machine always has one) would otherwise add a drift warning here. - c.fifa_game_dir = "/nonexistent/fifa-game-dir".into(); - let checks = run(&c); - assert_eq!(failures(&checks), 0, "must not be reported as fatal"); - assert_eq!(warnings(&checks), 1, "{checks:#?}"); + let check = hostname_mapping(&c); + assert_eq!(check.state, State::Warn, "{}", check.detail); + assert!( + check.detail.contains("localhost"), + "the warning must name the shadowed host: {}", + check.detail + ); } #[test]