Repository navigation
Run the fake FXServer tests on ports the system gives, so that two runs on one host no longer collide - #56
Merged
Merged
Conversation
…tem gives, so that two runs no longer collide
…y at a time as before
This was referenced Nov 11, 2026
Merged
Merged
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two commits, tests only. The tests of
crates/fake-fxserver/tests/bound fixed loopback ports: 41920 to 41928 forsupervisor.rs,pre_launch.rsandspawn.rs, 41926 to 41928 forruntime.rs, 41940 to 41942 forchanges.rs, 41960 to 41962 and 41956 forartifacts.rsandarchive.rs. Two checkouts that ran the suite at the same moment took each other's ports:AddrInUseinarchive.rs, aBindErrorthen "the status never came" or "the event never came" in the others. Each test now takes a port the system gives, and holds it until it ends.What changed
A port the system gives, held until the test ends (
b0e06aa)crates/fake-fxserver/tests/common/mod.rs, which the test files include asmod common;:Port::free()binds127.0.0.1:0, reads the port it was given, then claims it by binding the same port on127.0.0.2, held until the test drops it. The system may give a port again as soon as nothing listens on it, and FXServer only listens once it has started: a test of another run given the same port meanwhile cannot claim it, and asks for another.archive.rs:fake_archive_says_it_listens_only_on_a_port_of_its_ownstill holds the port with another listener beforefake-archiveis started on it, now on a port it claimed.spawn.rs: each test that gives the fake an endpoint takes aPort.a_taken_port_is_a_bind_error_then_a_fatal_exitholds127.0.0.1:0itself and expects the bind error on that address.The labs (
b102618)Ports::new(n)lends ports tonlabs of a file at a time: 9 insupervisor.rsandpre_launch.rs, 3 inruntime.rs,changes.rsandartifacts.rs. Those are the number of ports each file had, so no more servers run at once than before.common::panel(): the panel address the labs give Observer, which the cfg checks only compare with, is a port held for the whole run instead of127.0.0.1:41975, so that no server is given it.artifacts.rs:fake-archiveserves on a port claimed for the whole run of the binary instead of 41956.backups.rsis unchanged: 3306 and 3307 there are values of a connection string thatfake-dumpcopies into its dump. Nothing binds or connects to them.Why
Several checkouts of the repository on one machine run
cargo testorcargo xtask checkat the same time. Theirfake-fxservertests failed on each other's ports and passed when run again alone, so a check could take several tries.Notes for review
127.0.0.2: a port the system has just given is free on127.0.0.1, but nothing keeps another run from being given it again before the fake binds it. Holding the same port on a second loopback address leaves127.0.0.1to the fake and makes a second claim fail. Measured on Windows before writing it:127.0.0.1:Pbinds while127.0.0.2:Pis held, a second bind of127.0.0.2:Pfails withAddrInUse(10048), and 2,000 claims take 81 ms.d0bf382moved the test server ofobserver-artifactsfrom an ephemeral port to five fixed ones, because WSL hands out ephemeral ports from 32768, "a range that holds ports other servers on the same machine are known to use". This branch does the opposite forfake-fxserver, as many of the workspace's tests already do (observer/tests/run.rs,observer-sftp,observer-backups). Under WSL is where to look first if it misbehaves.observer-artifacts(41950 to 41954) and the browser tests' ports.tests/runtime.rsis also changed by other branches waiting to merge: the second to merge will meet a small conflict in itsuselines.Verified
main(41ac843): thearchivetest binary started twice at the same moment; one run failed withAddrInUse(10048) atarchive.rs:31, the failure the other checkouts met.cargo test -p fake-fxserver --no-fail-faststarted twice at the same moment, three rounds in a row. All six runs passed, 130 tests each, with noBindError,AddrInUseor "never came" in their output. Their timestamped output shows the same test binaries running at the same moments in both runs: in the first round,supervisor.rsstarted at 04:44:38 in both.b0e06aaon its own:cargo fmt -p fake-fxserver -- --check,cargo clippy -p fake-fxserver --all-targets -- -D warnings,cargo test -p fake-fxserver --test archive --test spawn.b102618:cargo xtask check, that is fmt, icons, clippy with-D warningswith and withouttest-catalog, 3,223 Rust tests passed and none failed, bindings unchanged, and inweb/format, lint, type check, 758 tests and the build, under Node 26.13.cargo xtask checkhad stopped atcrashes::tests::a_dump_still_growing_past_the_window_counts_as_in_progressinobserver-fxserver, which this branch does not touch. That test checks a 500 ms window, and it failed while the machine's CPU was at 100% with other checkouts checking at the same time. Run alone it then passed five times out of five, as did its whole binary, and the secondcargo xtask checkpassed whole.Not verified
127.0.0.2nor the suite ran there. Linux routes all of127.0.0.0/8to the loopback, but that was not tried.127.0.0.1by default and would refuse the claim. FXServer runs on Windows and Linux only.cargo xtask e2e: this branch changes no browser test.