Skip to content

Commit

Permalink
Timeout on coalesce test
Browse files Browse the repository at this point in the history
This test occasionally gets stuck! It's hard to reproduce though so this
timeout should detect and fail it.

Turning on trace logging for failures as well.
  • Loading branch information
SpamapS committed Jun 21, 2024
1 parent 8c680f8 commit 757c7f1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:

env:
CARGO_TERM_COLOR: always
RUST_LOG: trace

jobs:
build_and_test:
Expand Down
22 changes: 18 additions & 4 deletions rustygeard/tests/server.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
use std::{
sync::{Arc, Mutex},
thread,
time::Duration,
};

use rustygear::client::{Client, WorkUpdate};
use rustygeard::testutil::start_test_server;
use tokio::time::timeout;
use uuid::Uuid;

#[test]
Expand Down Expand Up @@ -68,8 +70,14 @@ async fn test_server_coalesces_uniqs() {
.await
.expect("Submitting uniqid1 on client2");
tx.send(()).await.expect("Sending to let the worker finish");
let response1 = job1.response().await.expect("Getting response to job1");
let response2 = job2.response().await.expect("Getting response to job2");
let response1 = timeout(Duration::from_millis(1000), job1.response())
.await
.expect("response1 timeout")
.expect("Getting response to job1");
let response2 = timeout(Duration::from_millis(1000), job2.response())
.await
.expect("reponse2 timeout")
.expect("Getting response to job2");
if let WorkUpdate::Complete {
handle: handle1,
payload: payload1,
Expand Down Expand Up @@ -99,8 +107,14 @@ async fn test_server_coalesces_uniqs() {
.expect("submitting uniqid2b job");
tx.send(()).await.expect("Sending to let the worker finish");
tx.send(()).await.expect("Sending to let the worker finish");
let response1b = job1b.response().await.expect("Getting response from job1b");
let response2b = job2b.response().await.expect("Getting response from job2b");
let response1b = timeout(Duration::from_millis(1000), job1b.response())
.await
.expect("response1b timeout")
.expect("Getting response from job1b");
let response2b = timeout(Duration::from_millis(1000), job2b.response())
.await
.expect("response2b timeout")
.expect("Getting response from job2b");
if let WorkUpdate::Complete {
handle: handle1b,
payload: _,
Expand Down

0 comments on commit 757c7f1

Please sign in to comment.