test(e2e): hand the serve test's share to the daemon, not the run

The serving process built its arguments by hand, so in daemon mode
--shared-dir stayed on the attached run, where shares belong to the
daemon and the flag is ignored. The daemon fell back to sharing its
default folder - which on a developer machine contains the probe files
earlier buggy runs deposited, so the test only passed by finding
served.bin in leftovers. args_with routes the share to the process
whose session does the sharing in either mode.
This commit is contained in:
Michel de Graaf
2026-07-29 17:02:35 +02:00
parent f525984a7b
commit d30e863fae
+11 -12
View File
@@ -2124,20 +2124,19 @@ fn serve_stays_online_and_reports_an_upload_a_peer_pulls() {
std::fs::write(share.path().join("served.bin"), probe_bytes()) std::fs::write(share.path().join("served.bin"), probe_bytes())
.expect("share file"); .expect("share file");
// A serving process: online, sharing, streaming upload records. // A serving process: online, sharing, streaming upload records. The share
let mut args = server.args("cli_e2e_server"); // is a session flag: in daemon mode it must reach the daemon, whose
// session does the sharing — handed to the run itself it would be
// silently ignored and the daemon would serve its default folder.
let mut args = server.args_with(
"cli_e2e_server",
&["--shared-dir".to_string(), share.display()],
);
args.retain(|arg| arg != "--quiet"); args.retain(|arg| arg != "--quiet");
args.extend( args.extend(
[ ["--json", "serve", "--duration", "25"]
"--shared-dir", .iter()
&share.display(), .map(|a| (*a).to_string()),
"--json",
"serve",
"--duration",
"25",
]
.iter()
.map(|a| (*a).to_string()),
); );
let refs: Vec<&str> = args.iter().map(String::as_str).collect(); let refs: Vec<&str> = args.iter().map(String::as_str).collect();
let child = command(&refs) let child = command(&refs)