Skip to content

Commit

Permalink
Update dogstatsd requirement from =0.11.0 to =0.11.1 (#53)
Browse files Browse the repository at this point in the history
* 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](mcasper/dogstatsd-rs@0.11.0...0.11.1)

---
updated-dependencies:
- dependency-name: dogstatsd
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Remove unused imports

* Fix lifetimes in tests

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: mae.kasza <[email protected]>
Co-authored-by: Cristiano Piemontese <[email protected]>
  • Loading branch information
3 people authored Mar 6, 2024
1 parent e4fbfe2 commit 87c49d0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
24 changes: 10 additions & 14 deletions src/tests/mocks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ mock! {
fn set(&self, metric: &str, val: &str, tags: Vec<String>);

/// Report the status of a service
fn service_check(
fn service_check<'a>(
&self,
metric: &str,
val: ServiceStatus,
tags: Vec<String>,
options: Option<ServiceCheckOptions>,
options: Option<ServiceCheckOptions<'a>>,
);

/// Send a custom event as a title and a body
Expand Down Expand Up @@ -197,28 +197,24 @@ pub fn service_check_mock(
metric: &'static str,
value: ServiceStatus,
tags: &'static [&str],
options: Option<ServiceCheckOptions>,
options: Option<ServiceCheckOptions<'static>>,
) -> 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<String>| called_tags.iter().all(|tag| tags.contains(&tag.as_str()))),
function(move |called_options: &Option<ServiceCheckOptions>| {
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
Expand Down

0 comments on commit 87c49d0

Please sign in to comment.