Skip to content

Commit

Permalink
Remove once_cell from test workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkusPettersson98 committed Nov 5, 2024
1 parent 53c17b1 commit 5297529
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 11 deletions.
2 changes: 0 additions & 2 deletions test/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ shadowsocks-service = "1.20.3"
windows-sys = "0.52.0"
chrono = { version = "0.4.26", default-features = false }
clap = { version = "4.2.7", features = ["cargo", "derive"] }
once_cell = "1.16.0"
bytes = "1.3.0"
async-trait = "0.1.58"
surge-ping = "0.8"
Expand Down
1 change: 0 additions & 1 deletion test/test-manager/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ thiserror = { workspace = true }
bytes = { workspace = true }
test_macro = { path = "./test_macro" }
ipnetwork = "0.20"
once_cell = { workspace = true }
inventory = "0.3"
data-encoding-macro = "0.1.12"
itertools = "0.10.5"
Expand Down
12 changes: 8 additions & 4 deletions test/test-manager/src/tests/config.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use once_cell::sync::OnceCell;
use std::sync::OnceLock;
use std::{ops::Deref, path::Path};
use test_rpc::meta::Os;

pub static TEST_CONFIG: TestConfigContainer = TestConfigContainer::new();

/// Default `mullvad_host`. This should match the production env.
pub const DEFAULT_MULLVAD_HOST: &str = "mullvad.net";
/// Bundled OpenVPN CA certificate use with the installed Mullvad app.
Expand Down Expand Up @@ -110,9 +112,13 @@ impl Default for BootstrapScript {
}

#[derive(Debug, Clone)]
pub struct TestConfigContainer(OnceCell<TestConfig>);
pub struct TestConfigContainer(OnceLock<TestConfig>);

impl TestConfigContainer {
const fn new() -> Self {
TestConfigContainer(OnceLock::new())
}

/// Initializes the constants.
///
/// # Panics
Expand All @@ -130,5 +136,3 @@ impl Deref for TestConfigContainer {
self.0.get().unwrap()
}
}

pub static TEST_CONFIG: TestConfigContainer = TestConfigContainer(OnceCell::new());
1 change: 0 additions & 1 deletion test/test-runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ tokio = { workspace = true }
tokio-serial = { workspace = true }
thiserror = { workspace = true }
log = { workspace = true }
once_cell = { workspace = true }
parity-tokio-ipc = "0.9"
bytes = { workspace = true }
serde = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions test/test-runner/src/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,10 @@ pub fn get_interface_mac(_interface: &str) -> Result<Option<[u8; 6]>, test_rpc::

#[cfg(target_os = "windows")]
pub fn get_default_interface() -> &'static str {
use once_cell::sync::OnceCell;
use std::sync::OnceLock;
use talpid_platform_metadata::WindowsVersion;

static WINDOWS_VERSION: OnceCell<WindowsVersion> = OnceCell::new();
static WINDOWS_VERSION: OnceLock<WindowsVersion> = OnceLock::new();
let version = WINDOWS_VERSION
.get_or_init(|| WindowsVersion::new().expect("failed to obtain Windows version"));

Expand Down

0 comments on commit 5297529

Please sign in to comment.