From 65286080e7977e3893a7bf74adcf432b708bfa13 Mon Sep 17 00:00:00 2001 From: Ronald Holshausen Date: Tue, 25 Jun 2024 16:24:27 +1000 Subject: [PATCH] fix: failing test on MacOS --- pact_mock_server/src/hyper_server.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pact_mock_server/src/hyper_server.rs b/pact_mock_server/src/hyper_server.rs index d843b9e1..97a6a0b8 100644 --- a/pact_mock_server/src/hyper_server.rs +++ b/pact_mock_server/src/hyper_server.rs @@ -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); } }