Skip to content

Commit

Permalink
Integration tests: test multiple callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
daladim committed Nov 7, 2022
1 parent 0f1b908 commit 6fc81c2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/dns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,11 @@ fn simple_user_dns_trace() {
fn test_event_id_filter() {
let passed1 = Status::new(TestKind::ExpectSuccess);
let passed2 = Status::new(TestKind::ExpectNoFailure);
let passed3 = Status::new(TestKind::ExpectSuccess);

let notifier1 = passed1.notifier();
let notifier2 = passed2.notifier();
let notifier3 = passed3.notifier();

let filter = EventFilter::ByEventIds(vec![EVENT_ID_DNS_QUERY_COMPLETED]);

Expand All @@ -78,6 +81,12 @@ fn test_event_id_filter() {
notifier2.notify_failure();
}
})
.add_callback(move |record: &EventRecord, _schema_locator: &SchemaLocator| {
// This secondary callback basically tests all callbacks are run
if record.event_id() == EVENT_ID_DNS_QUERY_COMPLETED {
notifier3.notify_success();
}
})
.build();

let _trace = UserTrace::new()
Expand All @@ -89,6 +98,7 @@ fn test_event_id_filter() {

passed1.assert_passed();
passed2.assert_passed();
passed3.assert_passed();
// Not calling .stop() here, let's just rely on the `impl Drop`

println!("test_event_id_filter passed");
Expand Down

0 comments on commit 6fc81c2

Please sign in to comment.