Skip to content

Commit

Permalink
chore: add small timeout to test
Browse files Browse the repository at this point in the history
  • Loading branch information
rholshausen committed Feb 3, 2025
1 parent d86ea2c commit cb06065
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rust/pact_matching/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -660,8 +660,8 @@ async fn body_matching_with_number_matchers() {
let matching_context = CoreMatchingContext::new(DiffConfig::AllowUnexpectedKeys,
&category, &hashmap!{});

// let result = match_body(&expected, &actual, &matching_context, &CoreMatchingContext::default()).await;
// expect!(result.mismatches().iter()).to(be_empty());
let result = match_body(&expected, &actual, &matching_context, &CoreMatchingContext::default()).await;
expect!(result.mismatches().iter()).to(be_empty());

let result2 = match_body(&expected, &actual2, &matching_context, &CoreMatchingContext::default()).await;
assert_ne!(result2.mismatches(), vec![]);
Expand Down
5 changes: 5 additions & 0 deletions rust/pact_verifier/src/pact_broker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1170,12 +1170,14 @@ pub struct PactVerificationProperties {

#[cfg(test)]
mod tests {
use std::time::Duration;
use expectest::expect;
use expectest::prelude::*;
use pact_models::{Consumer, PactSpecification, Provider};
use pact_models::prelude::RequestResponsePact;
use pact_models::sync_interaction::RequestResponseInteraction;
use pretty_assertions::assert_eq;
use tokio::time::sleep;

use pact_consumer::mock_server::StartMockServerAsync;
use pact_consumer::prelude::*;
Expand Down Expand Up @@ -1376,6 +1378,9 @@ mod tests {
let client = HALClient::with_url(pact_broker.url().as_str(), None);
let expected_requests = client.retries as usize;
let result = client.post_json(pact_broker.url().as_str(), "{}").await;

sleep(Duration::from_millis(100)).await;

expect!(result.clone()).to(be_err());
expect!(pact_broker.metrics().requests).to(be_equal_to(expected_requests ));
}
Expand Down

0 comments on commit cb06065

Please sign in to comment.