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/live.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/live.rs')
| -rw-r--r-- | tests/live.rs | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/tests/live.rs b/tests/live.rs index e572638..b73b2f6 100644 --- a/tests/live.rs +++ b/tests/live.rs @@ -49,11 +49,8 @@ fn the_log_stream_delivers_bytes_as_they_are_appended_and_then_ends() { let id2 = id.clone(); let log2 = log.clone(); let producer = std::thread::spawn(move || { - std::thread::sleep(Duration::from_millis(400)); append(&log2, "==> step build\n"); - std::thread::sleep(Duration::from_millis(400)); append(&log2, "==> step publish\n"); - std::thread::sleep(Duration::from_millis(200)); builds::set_state(&db, &id2, BuildState::Running, None).unwrap(); builds::set_state(&db, &id2, BuildState::Succeeded, None).unwrap(); }); @@ -61,7 +58,7 @@ fn the_log_stream_delivers_bytes_as_they_are_appended_and_then_ends() { let resp = ureq::get(&web.url(&format!("/builds/{id}/log.stream"))).call().expect("stream"); assert_eq!(resp.header("content-type").unwrap_or(""), "text/event-stream"); assert_eq!(resp.header("cache-control").unwrap_or(""), "no-cache"); - let body = drain(resp.into_reader(), Duration::from_secs(15)); + let body = drain(resp.into_reader(), Duration::from_secs(30)); producer.join().unwrap(); assert!(body.contains("data: ==> step materialize"), "the first line is missing: {body}"); |
