-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
66b240a
commit 45cae55
Showing
11 changed files
with
203 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[tools] | ||
rust = "1.74" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM rust:1.72.0 | ||
FROM rust:1.74.0 | ||
|
||
WORKDIR /code | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
use dogstatsd::EventAlertType; | ||
use dogstatsd::EventOptions; | ||
use dogstatsd::EventPriority; | ||
|
||
use crate::event; | ||
use crate::tests::mocks; | ||
use crate::tests::TestEvent; | ||
use crate::Datadog; | ||
use crate::TagTrackerConfiguration; | ||
use crate::EMPTY_TAGS; | ||
|
||
#[test] | ||
pub fn event_with_options_with_literal() { | ||
let mock = mocks::event_with_options_mock("test", "test_value", &[], None); | ||
Datadog::new(mock, TagTrackerConfiguration::new()).do_event_with_options("test", "test_value", EMPTY_TAGS, None); | ||
} | ||
|
||
#[test] | ||
pub fn event_with_options_with_type() { | ||
let mock = mocks::event_with_options_mock("test1_event", "test_value", &[], None); | ||
Datadog::new(mock, TagTrackerConfiguration::new()).do_event_with_options( | ||
TestEvent::Test1, | ||
"test_value", | ||
EMPTY_TAGS, | ||
None, | ||
); | ||
} | ||
|
||
#[test] | ||
pub fn event_with_options_with_literal_and_tags() { | ||
let mock = mocks::event_with_options_mock("test", "test_value", &["added:tag", "env:test"], None); | ||
Datadog::new(mock, TagTrackerConfiguration::new()).do_event_with_options( | ||
"test", | ||
"test_value", | ||
vec!["added:tag".to_string()], | ||
None, | ||
); | ||
} | ||
|
||
#[test] | ||
pub fn event_with_options_with_type_and_tags() { | ||
let mock = mocks::event_with_options_mock("test1_event", "test_value", &["added:tag", "env:test"], None); | ||
Datadog::new(mock, TagTrackerConfiguration::new()).do_event_with_options( | ||
TestEvent::Test1, | ||
"test_value", | ||
vec!["added:tag".to_string()], | ||
None, | ||
); | ||
} | ||
|
||
#[test] | ||
pub fn event_with_options_and_tags() { | ||
let options = Some( | ||
EventOptions::new() | ||
.with_alert_type(EventAlertType::Info) | ||
.with_priority(EventPriority::Low) | ||
.with_aggregation_key("aggregation_key") | ||
.with_source_type_name("source_type_name") | ||
.with_hostname("hostname") | ||
.with_timestamp(12341234), | ||
); | ||
|
||
let mock = mocks::event_with_options_mock("test1_event", "test_value", &["added:tag", "env:test"], options); | ||
Datadog::new(mock, TagTrackerConfiguration::new()).do_event_with_options( | ||
TestEvent::Test1, | ||
"test_value", | ||
vec!["added:tag".to_string()], | ||
options, | ||
); | ||
} | ||
|
||
#[test] | ||
pub fn test_macro() { | ||
let tag = String::from("tag"); | ||
// no tags with options | ||
event!("test", "test_value", EventOptions::new()); | ||
// just literal tags with options | ||
event!("test", "test_value", EventOptions::new(); "literal" => 1); | ||
// just expression tags with options | ||
event!("test", "test_value", EventOptions::new(); "expression" => tag); | ||
// mixed tags with options | ||
event!("test", "test_value", EventOptions::new(); "literal" => 1, "expression" => tag); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters