diff options
Diffstat (limited to 'third_party/rust/glean-core/tests')
-rw-r--r-- | third_party/rust/glean-core/tests/event.rs | 4 | ||||
-rw-r--r-- | third_party/rust/glean-core/tests/ping.rs | 46 | ||||
-rw-r--r-- | third_party/rust/glean-core/tests/ping_maker.rs | 23 |
3 files changed, 55 insertions, 18 deletions
diff --git a/third_party/rust/glean-core/tests/event.rs b/third_party/rust/glean-core/tests/event.rs index 48120956d7..20bf943113 100644 --- a/third_party/rust/glean-core/tests/event.rs +++ b/third_party/rust/glean-core/tests/event.rs @@ -167,6 +167,8 @@ fn test_sending_of_event_ping_when_it_fills_up() { false, true, true, + true, + vec![], vec!["max_capacity".to_string()], )); } @@ -452,6 +454,8 @@ fn event_storage_trimming() { false, true, true, + true, + vec![], vec![], )); diff --git a/third_party/rust/glean-core/tests/ping.rs b/third_party/rust/glean-core/tests/ping.rs index 17944b4c24..42f93e08c7 100644 --- a/third_party/rust/glean-core/tests/ping.rs +++ b/third_party/rust/glean-core/tests/ping.rs @@ -15,7 +15,7 @@ use glean_core::Lifetime; fn write_ping_to_disk() { let (mut glean, _temp) = new_glean(None); - let ping = PingType::new("metrics", true, false, true, true, vec![]); + let ping = PingType::new("metrics", true, false, true, true, true, vec![], vec![]); glean.register_ping_type(&ping); // We need to store a metric as an empty ping is not stored. @@ -36,7 +36,7 @@ fn write_ping_to_disk() { fn disabling_upload_clears_pending_pings() { let (mut glean, _t) = new_glean(None); - let ping = PingType::new("metrics", true, false, true, true, vec![]); + let ping = PingType::new("metrics", true, false, true, true, true, vec![], vec![]); glean.register_ping_type(&ping); // We need to store a metric as an empty ping is not stored. @@ -105,9 +105,18 @@ fn deletion_request_only_when_toggled_from_on_to_off() { fn empty_pings_with_flag_are_sent() { let (mut glean, _t) = new_glean(None); - let ping1 = PingType::new("custom-ping1", true, true, true, true, vec![]); + let ping1 = PingType::new("custom-ping1", true, true, true, true, true, vec![], vec![]); glean.register_ping_type(&ping1); - let ping2 = PingType::new("custom-ping2", true, false, true, true, vec![]); + let ping2 = PingType::new( + "custom-ping2", + true, + false, + true, + true, + true, + vec![], + vec![], + ); glean.register_ping_type(&ping2); // No data is stored in either of the custom pings @@ -139,10 +148,10 @@ fn test_pings_submitted_metric() { None, ); - let metrics_ping = PingType::new("metrics", true, false, true, true, vec![]); + let metrics_ping = PingType::new("metrics", true, false, true, true, true, vec![], vec![]); glean.register_ping_type(&metrics_ping); - let baseline_ping = PingType::new("baseline", true, false, true, true, vec![]); + let baseline_ping = PingType::new("baseline", true, false, true, true, true, vec![], vec![]); glean.register_ping_type(&baseline_ping); // We need to store a metric as an empty ping is not stored. @@ -218,7 +227,7 @@ fn test_pings_submitted_metric() { fn events_ping_with_metric_but_no_events_is_not_sent() { let (mut glean, _t) = new_glean(None); - let events_ping = PingType::new("events", true, true, true, true, vec![]); + let events_ping = PingType::new("events", true, true, true, true, true, vec![], vec![]); glean.register_ping_type(&events_ping); let counter = CounterMetric::new(CommonMetricData { name: "counter".into(), @@ -247,3 +256,26 @@ fn events_ping_with_metric_but_no_events_is_not_sent() { assert!(events_ping.submit_sync(&glean, None)); assert_eq!(1, get_queued_pings(glean.get_data_path()).unwrap().len()); } + +#[test] +fn test_scheduled_pings_are_sent() { + let (mut glean, _t) = new_glean(None); + + let piggyback_ping = PingType::new("piggyback", true, true, true, true, true, vec![], vec![]); + glean.register_ping_type(&piggyback_ping); + + let trigger_ping = PingType::new( + "trigger", + true, + true, + true, + true, + true, + vec!["piggyback".into()], + vec![], + ); + glean.register_ping_type(&trigger_ping); + + assert!(trigger_ping.submit_sync(&glean, None)); + assert_eq!(2, get_queued_pings(glean.get_data_path()).unwrap().len()); +} diff --git a/third_party/rust/glean-core/tests/ping_maker.rs b/third_party/rust/glean-core/tests/ping_maker.rs index f716dc4692..ac2dcbee11 100644 --- a/third_party/rust/glean-core/tests/ping_maker.rs +++ b/third_party/rust/glean-core/tests/ping_maker.rs @@ -13,7 +13,7 @@ fn set_up_basic_ping() -> (Glean, PingMaker, PingType, tempfile::TempDir) { let (tempdir, _) = tempdir(); let (mut glean, t) = new_glean(Some(tempdir)); let ping_maker = PingMaker::new(); - let ping_type = PingType::new("store1", true, false, true, true, vec![]); + let ping_type = PingType::new("store1", true, false, true, true, true, vec![], vec![]); glean.register_ping_type(&ping_type); // Record something, so the ping will have data @@ -95,7 +95,7 @@ fn test_metrics_must_report_experimentation_id() { }) .unwrap(); let ping_maker = PingMaker::new(); - let ping_type = PingType::new("store1", true, false, true, true, vec![]); + let ping_type = PingType::new("store1", true, false, true, true, true, vec![], vec![]); glean.register_ping_type(&ping_type); // Record something, so the ping will have data @@ -149,7 +149,7 @@ fn experimentation_id_is_removed_if_send_if_empty_is_false() { .unwrap(); let ping_maker = PingMaker::new(); - let unknown_ping_type = PingType::new("unknown", true, false, true, true, vec![]); + let unknown_ping_type = PingType::new("unknown", true, false, true, true, true, vec![], vec![]); glean.register_ping_type(&unknown_ping_type); assert!(ping_maker @@ -165,7 +165,7 @@ fn collect_must_report_none_when_no_data_is_stored() { let (mut glean, ping_maker, ping_type, _t) = set_up_basic_ping(); - let unknown_ping_type = PingType::new("unknown", true, false, true, true, vec![]); + let unknown_ping_type = PingType::new("unknown", true, false, true, true, true, vec![], vec![]); glean.register_ping_type(&ping_type); assert!(ping_maker @@ -189,7 +189,8 @@ fn seq_number_must_be_sequential() { for i in 0..=1 { for ping_name in ["store1", "store2"].iter() { - let ping_type = PingType::new(*ping_name, true, false, true, true, vec![]); + let ping_type = + PingType::new(*ping_name, true, false, true, true, true, vec![], vec![]); let ping = ping_maker .collect(&glean, &ping_type, None, "", "") .unwrap(); @@ -202,7 +203,7 @@ fn seq_number_must_be_sequential() { // Test that ping sequence numbers increase independently. { - let ping_type = PingType::new("store1", true, false, true, true, vec![]); + let ping_type = PingType::new("store1", true, false, true, true, true, vec![], vec![]); // 3rd ping of store1 let ping = ping_maker @@ -220,7 +221,7 @@ fn seq_number_must_be_sequential() { } { - let ping_type = PingType::new("store2", true, false, true, true, vec![]); + let ping_type = PingType::new("store2", true, false, true, true, true, vec![], vec![]); // 3rd ping of store2 let ping = ping_maker @@ -231,7 +232,7 @@ fn seq_number_must_be_sequential() { } { - let ping_type = PingType::new("store1", true, false, true, true, vec![]); + let ping_type = PingType::new("store1", true, false, true, true, true, vec![], vec![]); // 5th ping of store1 let ping = ping_maker @@ -246,7 +247,7 @@ fn seq_number_must_be_sequential() { fn clear_pending_pings() { let (mut glean, _t) = new_glean(None); let ping_maker = PingMaker::new(); - let ping_type = PingType::new("store1", true, false, true, true, vec![]); + let ping_type = PingType::new("store1", true, false, true, true, true, vec![], vec![]); glean.register_ping_type(&ping_type); // Record something, so the ping will have data @@ -274,7 +275,7 @@ fn no_pings_submitted_if_upload_disabled() { // Regression test, bug 1603571 let (mut glean, _t) = new_glean(None); - let ping_type = PingType::new("store1", true, true, true, true, vec![]); + let ping_type = PingType::new("store1", true, true, true, true, true, vec![], vec![]); glean.register_ping_type(&ping_type); assert!(ping_type.submit_sync(&glean, None)); @@ -292,7 +293,7 @@ fn no_pings_submitted_if_upload_disabled() { fn metadata_is_correctly_added_when_necessary() { let (mut glean, _t) = new_glean(None); glean.set_debug_view_tag("valid-tag"); - let ping_type = PingType::new("store1", true, true, true, true, vec![]); + let ping_type = PingType::new("store1", true, true, true, true, true, vec![], vec![]); glean.register_ping_type(&ping_type); assert!(ping_type.submit_sync(&glean, None)); |