diff options
Diffstat (limited to 'test/test-rpc/src')
| -rw-r--r-- | test/test-rpc/src/client.rs | 8 | ||||
| -rw-r--r-- | test/test-rpc/src/lib.rs | 3 | ||||
| -rw-r--r-- | test/test-rpc/src/meta.rs | 25 |
3 files changed, 15 insertions, 21 deletions
diff --git a/test/test-rpc/src/client.rs b/test/test-rpc/src/client.rs index 29f86b9443..2c47328e00 100644 --- a/test/test-rpc/src/client.rs +++ b/test/test-rpc/src/client.rs @@ -109,14 +109,6 @@ impl ServiceClient { .map_err(Error::Tarpc) } - /// Return the OS of the guest. - pub async fn get_os(&self) -> Result<meta::Os, Error> { - self.client - .get_os(tarpc::context::current()) - .await - .map_err(Error::Tarpc) - } - /// Wait for the Mullvad service to enter a specified state. The state is inferred from the presence /// of a named pipe or UDS, not the actual system service state. pub async fn mullvad_daemon_wait_for_state( diff --git a/test/test-rpc/src/lib.rs b/test/test-rpc/src/lib.rs index 73ab467ab8..5919a894d1 100644 --- a/test/test-rpc/src/lib.rs +++ b/test/test-rpc/src/lib.rs @@ -111,9 +111,6 @@ mod service { async fn get_mullvad_app_logs() -> logging::LogOutput; - /// Return the OS of the guest. - async fn get_os() -> meta::Os; - /// Return status of the system service. async fn mullvad_daemon_get_status() -> mullvad_daemon::ServiceStatus; diff --git a/test/test-rpc/src/meta.rs b/test/test-rpc/src/meta.rs index 67c87738e0..958733b9be 100644 --- a/test/test-rpc/src/meta.rs +++ b/test/test-rpc/src/meta.rs @@ -1,12 +1,26 @@ use serde::{Deserialize, Serialize}; +use std::str::FromStr; -#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)] +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone, Copy)] pub enum Os { Linux, Macos, Windows, } +impl FromStr for Os { + type Err = Box<dyn std::error::Error>; + + fn from_str(s: &str) -> Result<Self, Self::Err> { + match s { + "linux" => Ok(Os::Linux), + "macos" => Ok(Os::Macos), + "windows" => Ok(Os::Windows), + other => Err(format!("unknown os {other}").into()), + } + } +} + impl std::fmt::Display for Os { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { @@ -16,12 +30,3 @@ impl std::fmt::Display for Os { } } } - -#[cfg(target_os = "linux")] -pub const CURRENT_OS: Os = Os::Linux; - -#[cfg(target_os = "windows")] -pub const CURRENT_OS: Os = Os::Windows; - -#[cfg(target_os = "macos")] -pub const CURRENT_OS: Os = Os::Macos; |
