diff options
| author | Markus Pettersson <markus.pettersson@mullvad.net> | 2024-02-15 10:21:59 +0100 |
|---|---|---|
| committer | Markus Pettersson <markus.pettersson@mullvad.net> | 2024-02-15 10:21:59 +0100 |
| commit | 02240d69574e0d373c71d109e7ce4f006b916d2e (patch) | |
| tree | 02c86a5d58153997fd3a1773abf6555f2083d274 /test | |
| parent | 05a78732fc38c241a7465adca3f906d5f20c1ad6 (diff) | |
| parent | b226b8e634f4b9d7dff2f67c2752aa02bdd25a13 (diff) | |
| download | mullvadvpn-02240d69574e0d373c71d109e7ce4f006b916d2e.tar.xz mullvadvpn-02240d69574e0d373c71d109e7ce4f006b916d2e.zip | |
Merge branch 'fix/consider-direct-access-method-first'
Diffstat (limited to 'test')
| -rw-r--r-- | test/test-manager/src/tests/account.rs | 20 | ||||
| -rw-r--r-- | test/test-manager/src/tests/install.rs | 9 |
2 files changed, 15 insertions, 14 deletions
diff --git a/test/test-manager/src/tests/account.rs b/test/test-manager/src/tests/account.rs index 95b54b6432..1eeeb8c170 100644 --- a/test/test-manager/src/tests/account.rs +++ b/test/test-manager/src/tests/account.rs @@ -23,7 +23,7 @@ pub async fn test_login( // Instruct daemon to log in // - clear_devices(&new_device_client().await) + clear_devices(&new_device_client()) .await .expect("failed to clear devices"); @@ -65,7 +65,7 @@ pub async fn test_too_many_devices( ) -> Result<(), Error> { log::info!("Using up all devices"); - let device_client = new_device_client().await; + let device_client = new_device_client(); const MAX_ATTEMPTS: usize = 15; @@ -151,7 +151,7 @@ pub async fn test_revoked_device( log::debug!("Removing current device"); - let device_client = new_device_client().await; + let device_client = new_device_client(); retry_if_throttled(|| { device_client.remove(TEST_CONFIG.account_number.clone(), device_id.clone()) }) @@ -217,9 +217,10 @@ pub async fn clear_devices(device_client: &DevicesProxy) -> Result<(), mullvad_a Ok(()) } -pub async fn new_device_client() -> DevicesProxy { - let api_endpoint = mullvad_api::ApiEndpoint::from_env_vars(); +pub fn new_device_client() -> DevicesProxy { + use mullvad_api::{proxy::ApiConnectionMode, ApiEndpoint, API}; + let api_endpoint = ApiEndpoint::from_env_vars(); let api_host = format!("api.{}", TEST_CONFIG.mullvad_host); let api_address = format!("{api_host}:443") .to_socket_addrs() @@ -228,7 +229,7 @@ pub async fn new_device_client() -> DevicesProxy { .unwrap(); // Override the API endpoint to use the one specified in the test config - let _ = mullvad_api::API.override_init(mullvad_api::ApiEndpoint { + let _ = API.override_init(ApiEndpoint { host: Some(api_host), address: Some(api_address), ..api_endpoint @@ -236,9 +237,10 @@ pub async fn new_device_client() -> DevicesProxy { let api = mullvad_api::Runtime::new(tokio::runtime::Handle::current()) .expect("failed to create api runtime"); - let rest_handle = api - .mullvad_rest_handle(mullvad_api::proxy::ApiConnectionMode::Direct.into_repeat()) - .await; + let rest_handle = api.mullvad_rest_handle( + ApiConnectionMode::Direct, + ApiConnectionMode::Direct.into_repeat(), + ); DevicesProxy::new(rest_handle) } diff --git a/test/test-manager/src/tests/install.rs b/test/test-manager/src/tests/install.rs index 614b9d9bb9..8f2f2cdff2 100644 --- a/test/test-manager/src/tests/install.rs +++ b/test/test-manager/src/tests/install.rs @@ -49,7 +49,7 @@ pub async fn test_upgrade_app(ctx: TestContext, rpc: ServiceClient) -> Result<() return Err(Error::DaemonNotRunning); } - super::account::clear_devices(&super::account::new_device_client().await) + super::account::clear_devices(&super::account::new_device_client()) .await .expect("failed to clear devices"); @@ -227,10 +227,9 @@ pub async fn test_uninstall_app( } // verify that device was removed - let devices = - super::account::list_devices_with_retries(&super::account::new_device_client().await) - .await - .expect("failed to list devices"); + let devices = super::account::list_devices_with_retries(&super::account::new_device_client()) + .await + .expect("failed to list devices"); assert!( !devices.iter().any(|device| device.id == uninstalled_device), |
