From 504ceeec8749d8f912e88dea8abb9a7fc88ddf21 Mon Sep 17 00:00:00 2001 From: funman300 Date: Mon, 17 Aug 2026 22:06:41 +0000 Subject: [PATCH] launcher: stop the shadowed-hostname test asserting the local machine's ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It counted Pass/Warn/Fail across the whole preflight run, and `backend_reachable` opens real sockets — so the aggregate silently asserted that the machine running the suite has the OpenFUT blaze-redirector and account ports open. True on the server host, false everywhere else, including the game machine where anyone building the launcher would run it. Predates this branch; found by running the suite on .105 instead of only here. Now asserts the hostname check itself, which is what the test is named for. --- src/preflight.rs | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) 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]