~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/knotless

git that lives in your Atmosphere account

knotless.dev
1 collaborator

knotless 0.13.0 Latest 2 packages, 1 image

1
10

knotless-run: The gate test holds a pull under one runner and ejects it under another

Merged chadtmiller.com asked to merge into main from chadtmiller.com/knotless:run/gate-wait-held
crates/knotless-run/tests/run.rs+12−10
@@ -4080,11 +4080,11 @@ fn a_merge_queue_waits_for_its_gate() {
let rt = tokio::runtime::Runtime::new().unwrap();
let q = Line::new(&rt);
let url = q.url.clone();
// Room for a loaded run's pass to see it waiting before the wait is up
// (the check below is skipped when it does not), and no more: the test
// sits out what is left of it.
let wait = Duration::from_secs(8);
let l = q.lander(&rt, "state.json", |opts| opts.review_wait = wait);
// A wait no pass outlasts, however loaded the run: a pull queued under
// it is held, always. Its end comes from a second runner, below.
let l = q.lander(&rt, "state.json", |opts| {
opts.review_wait = Duration::from_secs(3600)
});
let mut gate = Sandbox::new();
gate.set("KNOTLESS_APPVIEW", &q.base);
let handle = gate.account.handle.clone();
@@ -4125,20 +4125,22 @@ fn a_merge_queue_waits_for_its_gate() {
q.main() != start
});
// One it has not reviewed waits, and goes once the wait is up.
// One it has not reviewed waits, and goes once the wait is up: here,
// under a runner whose wait is a second, once that second is past.
let b = q.pull("b", "b", "b\n");
q.queue(&[&b]);
let queued = std::time::Instant::now();
l.pass(&rt);
if queued.elapsed() < wait {
assert!(!q.ok(&["pull", "show", &url, &b]).contains("ejected"));
}
assert!(!q.ok(&["pull", "show", &url, &b]).contains("ejected"));
drop(l);
let wait = Duration::from_secs(1);
std::thread::sleep(wait.saturating_sub(queued.elapsed()));
let l = q.lander(&rt, "state.json", |opts| opts.review_wait = wait);
l.pass(&rt);
let shown = q.shows(&b, "merge queue: ejected");
// What it waits for and how long, then how to give it.
let wanted = format!(
"a review of its head from @{handle}. It waited 8s for that review. Anyone but its author who may write"
"a review of its head from @{handle}. It waited 1s for that review. Anyone but its author who may write"
);
assert!(shown.contains(&wanted), "{shown}");
}