summaryrefslogtreecommitdiffstats
path: root/tests/remote_agent.rs
diff options
context:
space:
mode:
authoraur-build <aur-build@localhost>2026-11-19 17:33:17 +0000
committeraur-build <aur-build@localhost>2026-11-19 17:33:17 +0000
commit4304b0f336ddba7b4ec6780795059ff2066d105b (patch)
tree10edea744a1c2bf3fc363b4dc7f64abac8b1a0d3 /tests/remote_agent.rs
parente757979f1a2afdbe7146066345bb9acd19d3b151 (diff)
downloadaur-build-4304b0f336ddba7b4ec6780795059ff2066d105b.tar.gz
aur-build-4304b0f336ddba7b4ec6780795059ff2066d105b.zip
comments: keep only what the code cannot show
Stripped every comment that described what an item does, documented its arguments or fields, or cited the design docs (§n, I-n, m-n, decision n). 2247 comments down to 83. What survives: the section dividers that segment the large modules, the secret-handling warnings, the agent wire-frame directions, and the few notes without which the code they attach to reads as redundant, reorderable, or unsound.
Diffstat (limited to 'tests/remote_agent.rs')
-rw-r--r--tests/remote_agent.rs20
1 files changed, 0 insertions, 20 deletions
diff --git a/tests/remote_agent.rs b/tests/remote_agent.rs
index af4ac60..534b346 100644
--- a/tests/remote_agent.rs
+++ b/tests/remote_agent.rs
@@ -32,27 +32,22 @@ fn a_full_build_runs_over_the_agent_protocol() {
let addr = backend.local_addr().to_string();
ctx.backend = Arc::new(backend);
- // The sandbox dials the hub; the hub never dials it.
let mut agent = std::process::Command::new(agent_bin())
.args(["--hub", &addr, "--token", "test-token", "--ttl", "30"])
.spawn()
.expect("spawn sandbox-agent");
let out = pipeline::run_with(&ctx).unwrap();
- // Kill *and* reap: an unreaped child is a zombie the next test inherits.
let _ = agent.kill();
let _ = agent.wait();
assert!(matches!(out, pipeline::Outcome::Succeeded { .. }), "{out:?}");
- // The agent-streamed output landed in the same file the SSE tail reads.
let log = std::fs::read_to_string(env.cfg.build_log_path(&id)).unwrap();
assert!(
log.contains("Making package"),
"agent-streamed output must reach the build log:\n{log}"
);
- // The build really ran as the agent's child, with the shim protocol applied
- // from the Run frame's environment.
let shimlog = env.cfg.hooks.shim_dir.clone().unwrap();
assert_eq!(aur_build::shims::called_with(&shimlog, "makepkg", ""), 1);
}
@@ -79,7 +74,6 @@ fn blobs_round_trip_over_the_wire_and_a_bad_token_is_refused() {
sbx.destroy().unwrap();
let _ = good.wait();
- // A stranger's box is refused at the rendezvous, not leased and hoped about.
let mut bad = std::process::Command::new(agent_bin())
.args(["--hub", &addr, "--token", "wrong-token", "--ttl", "30"])
.spawn()
@@ -92,10 +86,6 @@ fn blobs_round_trip_over_the_wire_and_a_bad_token_is_refused() {
let _ = bad.wait();
}
-// One listener per process. Constructing a remote backend bound the agent
-// listener, so a second concurrent build on a fixed `listen` died of EADDRINUSE
-// for a reason that had nothing to do with its package.
-
fn remote_cfg(listen: &str, token: &str) -> aur_build::config::Config {
aur_build::config::Config {
sandbox: aur_build::config::Sandbox::Remote {
@@ -107,8 +97,6 @@ fn remote_cfg(listen: &str, token: &str) -> aur_build::config::Config {
}
}
-/// A port nothing is holding, so two backends can be asked for the *same* fixed
-/// address — the only case where double-binding shows up.
fn free_port() -> u16 {
let l = std::net::TcpListener::bind("127.0.0.1:0").unwrap();
let port = l.local_addr().unwrap().port();
@@ -125,17 +113,12 @@ fn two_builds_share_one_agent_listener() {
let (sa, sb) = (&a.status().unwrap()[0].id, &b.status().unwrap()[0].id);
assert_eq!(sa, sb, "both must report the one listener: {sa} vs {sb}");
assert!(sa.contains(&addr), "and it must be the configured address: {sa}");
- // Why the sharing matters, asserted rather than assumed: a raw second bind on a
- // listening address is EADDRINUSE. If this ever passes, the test above is
- // vacuous.
assert!(
std::net::TcpListener::bind(&addr).is_err(),
"a second bind on {addr} must fail, or nothing here proves anything"
);
}
-/// Sharing the listener means sharing the queue of dial-ins: an agent dials in when
-/// the operator boots one, and whichever build is waiting takes it.
#[test]
fn a_dial_in_goes_to_whichever_backend_is_waiting() {
let addr = format!("127.0.0.1:{}", free_port());
@@ -155,8 +138,6 @@ fn a_dial_in_goes_to_whichever_backend_is_waiting() {
assert!(sbx.is_ok(), "the second backend must be able to take the dial-in: {:?}", sbx.err());
}
-/// Two tokens cannot share a listener, and quietly reusing the first one's would
-/// be a fail-open surprise — so the second bind is attempted and fails loudly.
#[test]
fn a_different_token_on_the_same_address_is_refused_not_shared() {
let addr = format!("127.0.0.1:{}", free_port());
@@ -165,7 +146,6 @@ fn a_different_token_on_the_same_address_is_refused_not_shared() {
assert!(second.is_err(), "two tokens on one address must not silently share a listener");
}
-/// The contract in its literal shape: two workers, two builds, one listener.
#[test]
fn two_concurrent_builds_do_not_fight_over_the_listener() {
let addr = format!("127.0.0.1:{}", free_port());