Skip to content

Commit

Permalink
fix: failing test on MacOS
Browse files Browse the repository at this point in the history
  • Loading branch information
rholshausen committed Jun 25, 2024
1 parent 376b4cf commit 6528608
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pact_mock_server/src/hyper_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -625,15 +625,17 @@ mod tests {
shutdown.send(()).unwrap();
let _ = handle.await;

assert_eq!(events.len(), 4);
// Should be at least 3 events
expect!(events.len()).to(be_greater_or_equal_to(3));
assert_eq!(events.recv().await.unwrap(), MockServerEvent::RequestReceived("/".to_string()));
if let MockServerEvent::RequestMatch(_) = events.recv().await.unwrap() {
// expected
} else {
panic!("Was expected a request match event");
}
// For some reason, a http2 connection returns an error once the server is shutdown
assert_eq!(events.recv().await.unwrap(), MockServerEvent::ConnectionFailed("connection error".to_string()));
assert_eq!(events.recv().await.unwrap(), MockServerEvent::ServerShutdown);
// For some reason, a http2 connection returns an error once the server is shutdown on Linux
let mut events_list = vec![];
events.recv_many(&mut events_list, 2).await;
assert_eq!(events_list.last().unwrap(), &MockServerEvent::ServerShutdown);
}
}

0 comments on commit 6528608

Please sign in to comment.