diff options
| author | aur-build <aur-build@localhost> | 2026-11-19 20:27:26 +0000 |
|---|---|---|
| committer | aur-build <aur-build@localhost> | 2026-11-19 20:27:26 +0000 |
| commit | 3cb78f6bc988beaf0408100a1425c02933d8957f (patch) | |
| tree | 1130d54d02369050aaeda7017b89934d576b787f /tests/crash.rs | |
| parent | f139b9ae0e8d98dc98e1dec6bb0fc427d36ccefa (diff) | |
| download | aur-build-3cb78f6bc988beaf0408100a1425c02933d8957f.tar.gz aur-build-3cb78f6bc988beaf0408100a1425c02933d8957f.zip | |
tests: wait on the condition instead of on the clock
The dispatch and crash waits polled every 50ms and 25ms against a dispatcher
that ticks every two seconds; live.rs staged its log appends with 400ms sleeps;
vcs.rs waited 80ms to conclude that a blocked racer had not entered. The pool
tests take the virtual clock and poll a 2ms condition wait, live.rs appends
without sleeping at all, and the Stage B test queues every racer on the slot
before releasing it, so the window a broken cap would slip through is set up
rather than hoped for.
live.rs no longer proves delivery mid-stream, because it never could: the stream
response is buffered until it ends, so the sleeps were not observable. Worth
fixing on the serving side, but that is a behaviour change, not a test one.
Diffstat (limited to 'tests/crash.rs')
| -rw-r--r-- | tests/crash.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/crash.rs b/tests/crash.rs index ca7d90a..1e72177 100644 --- a/tests/crash.rs +++ b/tests/crash.rs @@ -148,16 +148,17 @@ fn a_failed_build_leaves_the_index_serving_the_old_version_and_says_so() { fn a_transient_failure_retries_but_a_deterministic_one_never_does() { let (mut env, _fx) = env_with_fixture("build-fails"); let id = queued(&env, "build-fails"); + let _clock = aur_build::time::virtualize(); let pool = aur_build::pipeline::dispatch::Pool::spawn(std::sync::Arc::new(env.cfg.clone()), env.db.clone()); let mut state = BuildState::Queued; - for _ in 0..400 { + for _ in 0..15_000 { if let Some(b) = builds::get(&env.db, &id).unwrap() { state = b.state; if state == BuildState::Failed { break; } } - std::thread::sleep(std::time::Duration::from_millis(25)); + std::thread::sleep(std::time::Duration::from_millis(2)); } pool.shutdown(); assert_eq!(state, BuildState::Failed); |
