Skip to content

Commit

Permalink
add a line to check whether stream connection returns an error
Browse files Browse the repository at this point in the history
  • Loading branch information
dailinsubjam committed Dec 2, 2024
1 parent bca48d1 commit ee22e9b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions crates/shared/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,17 @@ mod tests {
EventServiceStream::<TestTypes, MockVersion>::RETRY_PERIOD + Duration::from_millis(500),
)
.await; // Wait longer than idle timeout
// Check whether stream returns Err(_) after idle timeout
match timeout(
EventServiceStream::<TestTypes, MockVersion>::RETRY_PERIOD,
stream.next(),
)
.await
{
Ok(Some(_)) => panic!("Expected error after idle timeout but got an event"),
Ok(None) => panic!("Expected error but got None"),
Err(err) => println!("Stream returned an error after idle timeout: {:?}", err),
}

// Stream should reconnect after idle timeout
let new_app_handle = run_app("hotshot-events", url.clone());
Expand Down

0 comments on commit ee22e9b

Please sign in to comment.