Debian Codegraph @

third_party/rust/glean/tests/persist_ping_lifetime_nopanic.rs

raw
1 // This Source Code Form is subject to the terms of the Mozilla Public
2 // License, v. 2.0. If a copy of the MPL was not distributed with this
3 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
5 //! This integration test should model how the RLB is used when embedded in another Rust application
6 //! (e.g. FOG/Firefox Desktop).
7 //!
8 //! We write a single test scenario per file to avoid any state keeping across runs
9 //! (different files run as different processes).
10
11 mod common;
12
13 use glean::{Configuration, ConfigurationBuilder};
14 use std::path::PathBuf;
15
16 fn cfg_new(tmpname: PathBuf) -> Configuration {
17 ConfigurationBuilder::new(true, tmpname, "firefox-desktop")
18 .with_server_endpoint("invalid-test-host")
19 .with_delay_ping_lifetime_io(true)
20 .build()
21 }
22
23 /// Test scenario: `persist_ping_lifetime_data` called after shutdown.
24 #[test]
25 fn delayed_ping_data() {
26 common::enable_test_logging();
27
28 // Create a custom configuration to delay ping-lifetime io
29 let dir = tempfile::tempdir().unwrap();
30 let tmpname = dir.path().to_path_buf();
31
32 common::initialize(cfg_new(tmpname));
33 glean::persist_ping_lifetime_data();
34
35 glean::shutdown();
36 glean::persist_ping_lifetime_data();
37 }