summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--test/test-manager/src/tests/helpers.rs9
-rw-r--r--test/test-manager/src/tests/install.rs15
-rw-r--r--test/test-manager/src/tests/mod.rs3
3 files changed, 18 insertions, 9 deletions
diff --git a/test/test-manager/src/tests/helpers.rs b/test/test-manager/src/tests/helpers.rs
index 30f89267cc..3956aa2c15 100644
--- a/test/test-manager/src/tests/helpers.rs
+++ b/test/test-manager/src/tests/helpers.rs
@@ -191,8 +191,9 @@ pub async fn ping_with_timeout(
/// Try to connect to a Mullvad Tunnel.
///
-/// If that fails for whatever reason, the Mullvad daemon ends up in the
-/// [`TunnelState::Error`] state & [`Error::DaemonError`] is returned.
+/// If that fails to begin to connect, [`Error::DaemonError`] is returned. If it fails to connect
+/// after that, the daemon ends up in the [`TunnelState::Error`] state, and
+/// [`Error::UnexpectedErrorState`] is returned.
pub async fn connect_and_wait(mullvad_client: &mut MullvadProxyClient) -> Result<(), Error> {
log::info!("Connecting");
@@ -209,8 +210,8 @@ pub async fn connect_and_wait(mullvad_client: &mut MullvadProxyClient) -> Result
})
.await?;
- if matches!(new_state, TunnelState::Error(..)) {
- return Err(Error::Daemon("daemon entered error state".to_string()));
+ if let TunnelState::Error(error_state) = new_state {
+ return Err(Error::UnexpectedErrorState(error_state));
}
log::info!("Connected");
diff --git a/test/test-manager/src/tests/install.rs b/test/test-manager/src/tests/install.rs
index c6d362825e..614b9d9bb9 100644
--- a/test/test-manager/src/tests/install.rs
+++ b/test/test-manager/src/tests/install.rs
@@ -277,15 +277,20 @@ pub async fn test_install_new_app(_: TestContext, rpc: ServiceClient) -> Result<
///
/// This test is supposed to guard against regressions to this fix included in
/// the 2021.3-beta1 release:
-/// https://github.com/mullvad/mullvadvpn-app/blob/main/CHANGELOG.md#security-10
+/// https://github.com/mullvad/mullvadvpn-app/blob/2021.3-beta1/CHANGELOG.md#security
#[test_function(priority = -150)]
pub async fn test_installation_idempotency(
_: TestContext,
rpc: ServiceClient,
mut mullvad_client: MullvadProxyClient,
) -> Result<(), Error> {
- // Connect to any relay
- connect_and_wait(&mut mullvad_client).await?;
+ // Connect to any relay. This forces the daemon to enter a secured target state
+ connect_and_wait(&mut mullvad_client)
+ .await
+ .or_else(|error| match error {
+ Error::UnexpectedErrorState(_) => Ok(()),
+ err => Err(err),
+ })?;
// Disable auto-connect
mullvad_client
.set_auto_connect(false)
@@ -302,8 +307,8 @@ pub async fn test_installation_idempotency(
log::debug!("Installing new app");
rpc.install_app(get_package_desc(&TEST_CONFIG.current_app_filename)?)
.await?;
- // verify that daemon is running
- wait_for_tunnel_state(mullvad_client.clone(), |state| state.is_connected())
+ // verify that the daemon starts in a non-disconnected state
+ wait_for_tunnel_state(mullvad_client.clone(), |state| !state.is_disconnected())
.await
.map_err(|err| {
log::error!(
diff --git a/test/test-manager/src/tests/mod.rs b/test/test-manager/src/tests/mod.rs
index 8bebfe13df..c79c0318e0 100644
--- a/test/test-manager/src/tests/mod.rs
+++ b/test/test-manager/src/tests/mod.rs
@@ -58,6 +58,9 @@ pub enum Error {
#[error(display = "The daemon returned an error: {}", _0)]
Daemon(String),
+ #[error(display = "The daemon ended up in the error state")]
+ UnexpectedErrorState(talpid_types::tunnel::ErrorState),
+
#[error(display = "The gRPC client ran into an error: {}", _0)]
ManagementInterface(#[source] mullvad_management_interface::Error),