From 87c49d09de1a044bd2c01fa09c53124b5b6420e6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Mar 2024 09:13:49 +0100 Subject: [PATCH] Update dogstatsd requirement from =0.11.0 to =0.11.1 (#53) * Update dogstatsd requirement from =0.11.0 to =0.11.1 Updates the requirements on [dogstatsd](https://github.com/mcasper/dogstatsd-rs) to permit the latest version. - [Changelog](https://github.com/mcasper/dogstatsd-rs/blob/master/CHANGELOG.md) - [Commits](https://github.com/mcasper/dogstatsd-rs/compare/0.11.0...0.11.1) --- updated-dependencies: - dependency-name: dogstatsd dependency-type: direct:production ... Signed-off-by: dependabot[bot] * Remove unused imports * Fix lifetimes in tests --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: mae.kasza <26093674+MaeIsBad@users.noreply.github.com> Co-authored-by: Cristiano Piemontese --- Cargo.toml | 2 +- src/tests/mocks/mod.rs | 24 ++++++++++-------------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8da400c..20efaf3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ serde = ["dep:serde"] [dependencies] async-trait = "0.1" -dogstatsd = {version = "=0.11.0", default-features = false} +dogstatsd = {version = "=0.11.1", default-features = false} once_cell = {version = "1.9", default-features = false, features = ["std"]} thiserror = {version = "1.0", default-features = false} diff --git a/src/tests/mocks/mod.rs b/src/tests/mocks/mod.rs index 8486007..4e15bc1 100644 --- a/src/tests/mocks/mod.rs +++ b/src/tests/mocks/mod.rs @@ -38,12 +38,12 @@ mock! { fn set(&self, metric: &str, val: &str, tags: Vec); /// Report the status of a service - fn service_check( + fn service_check<'a>( &self, metric: &str, val: ServiceStatus, tags: Vec, - options: Option, + options: Option>, ); /// Send a custom event as a title and a body @@ -197,28 +197,24 @@ pub fn service_check_mock( metric: &'static str, value: ServiceStatus, tags: &'static [&str], - options: Option, + options: Option>, ) -> MockClient { let mut client_mock = MockClient::new(); client_mock .expect_service_check() .once() - .with( - eq(metric), - function(move |called_value: &ServiceStatus| { - matches!( - (called_value, value), + .withf(move |called_metric, called_status, called_tags, called_options| { + called_metric == metric + && matches!( + (called_status, value), (ServiceStatus::OK, ServiceStatus::OK) | (ServiceStatus::Critical, ServiceStatus::Critical) | (ServiceStatus::Unknown, ServiceStatus::Unknown) | (ServiceStatus::Warning, ServiceStatus::Warning) ) - }), - function(move |called_tags: &Vec| called_tags.iter().all(|tag| tags.contains(&tag.as_str()))), - function(move |called_options: &Option| { - matches!((called_options, options), (Some(_), Some(_)) | (None, None)) - }), - ) + && called_tags.iter().all(|tag| tags.contains(&tag.as_str())) + && matches!((called_options, options), (Some(_), Some(_)) | (None, None)) + }) .return_const(()); client_mock