launcher: stop the shadowed-hostname test asserting the local machine's ports

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.
This commit is contained in:
funman300
2026-08-17 22:06:41 +00:00
parent cbf697bcd5
commit 504ceeec87
+13 -8
View File
@@ -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]