summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--test/connection-checker/src/main.rs6
-rw-r--r--test/connection-checker/src/net.rs2
-rw-r--r--test/socks-server/src/lib.rs3
-rw-r--r--test/test-manager/src/main.rs6
-rw-r--r--test/test-manager/src/network_monitor.rs3
-rw-r--r--test/test-manager/src/run_tests.rs15
-rw-r--r--test/test-manager/src/tests/account.rs13
-rw-r--r--test/test-manager/src/tests/dns.rs24
-rw-r--r--test/test-manager/src/tests/install.rs36
-rw-r--r--test/test-manager/src/tests/relay_ip_overrides.rs6
-rw-r--r--test/test-manager/src/tests/settings.rs34
-rw-r--r--test/test-manager/src/tests/test_metadata.rs3
-rw-r--r--test/test-manager/src/tests/tunnel.rs43
-rw-r--r--test/test-manager/src/tests/ui.rs12
-rw-r--r--test/test-manager/src/vm/provision.rs17
-rw-r--r--test/test-manager/src/vm/ssh.rs6
-rw-r--r--test/test-manager/src/vm/tart.rs2
-rw-r--r--test/test-manager/src/vm/update.rs6
-rw-r--r--test/test-manager/test_macro/src/lib.rs2
-rw-r--r--test/test-runner/src/forward.rs15
-rw-r--r--test/test-runner/src/logging.rs9
-rw-r--r--test/test-runner/src/sys.rs39
22 files changed, 136 insertions, 166 deletions
diff --git a/test/connection-checker/src/main.rs b/test/connection-checker/src/main.rs
index ed48999970..16050f322e 100644
--- a/test/connection-checker/src/main.rs
+++ b/test/connection-checker/src/main.rs
@@ -4,8 +4,10 @@ use reqwest::blocking::Client;
use serde::Deserialize;
use std::{io::stdin, time::Duration};
-use connection_checker::cli::Opt;
-use connection_checker::net::{send_ping, send_tcp, send_udp};
+use connection_checker::{
+ cli::Opt,
+ net::{send_ping, send_tcp, send_udp},
+};
fn main() -> eyre::Result<()> {
let opt = Opt::parse();
diff --git a/test/connection-checker/src/net.rs b/test/connection-checker/src/net.rs
index 6634be41b0..2e17423933 100644
--- a/test/connection-checker/src/net.rs
+++ b/test/connection-checker/src/net.rs
@@ -52,7 +52,7 @@ pub fn send_udp(_opt: &Opt, destination: SocketAddr) -> Result<(), eyre::Error>
sock.bind(&socket2::SockAddr::from(bind_addr))
.wrap_err(eyre!("Failed to bind UDP socket to {bind_addr}"))?;
- //log::debug!("Send message from {bind_addr} to {destination}/UDP");
+ // log::debug!("Send message from {bind_addr} to {destination}/UDP");
let std_socket = std::net::UdpSocket::from(sock);
std_socket
diff --git a/test/socks-server/src/lib.rs b/test/socks-server/src/lib.rs
index 9a85297036..1b3e712643 100644
--- a/test/socks-server/src/lib.rs
+++ b/test/socks-server/src/lib.rs
@@ -1,6 +1,5 @@
use futures::StreamExt;
-use std::io;
-use std::net::SocketAddr;
+use std::{io, net::SocketAddr};
#[derive(thiserror::Error, Debug)]
pub enum Error {
diff --git a/test/test-manager/src/main.rs b/test/test-manager/src/main.rs
index f81bf77594..a708c3fe29 100644
--- a/test/test-manager/src/main.rs
+++ b/test/test-manager/src/main.rs
@@ -11,8 +11,7 @@ mod vm;
use std::path::PathBuf;
-use anyhow::Context;
-use anyhow::Result;
+use anyhow::{Context, Result};
use clap::Parser;
use std::net::SocketAddr;
use tests::config::DEFAULT_MULLVAD_HOST;
@@ -81,7 +80,8 @@ enum Commands {
///
/// # Note
///
- /// The gRPC interface must be compatible with the version specified for `mullvad-management-interface` in Cargo.toml.
+ /// The gRPC interface must be compatible with the version specified for
+ /// `mullvad-management-interface` in Cargo.toml.
#[arg(long, short)]
current_app: String,
diff --git a/test/test-manager/src/network_monitor.rs b/test/test-manager/src/network_monitor.rs
index c48a660ba0..87a8193e29 100644
--- a/test/test-manager/src/network_monitor.rs
+++ b/test/test-manager/src/network_monitor.rs
@@ -14,8 +14,7 @@ use pnet_packet::{
pub use pnet_packet::ip::IpNextHeaderProtocols as IpHeaderProtocols;
-use crate::tests::config::TEST_CONFIG;
-use crate::vm::network::CUSTOM_TUN_INTERFACE_NAME;
+use crate::{tests::config::TEST_CONFIG, vm::network::CUSTOM_TUN_INTERFACE_NAME};
struct Codec {
no_frame: bool,
diff --git a/test/test-manager/src/run_tests.rs b/test/test-manager/src/run_tests.rs
index b2b1e9534b..38e5253fe8 100644
--- a/test/test-manager/src/run_tests.rs
+++ b/test/test-manager/src/run_tests.rs
@@ -1,16 +1,15 @@
-use crate::summary::{self, maybe_log_test_result};
-use crate::tests::{config::TEST_CONFIG, TestContext};
use crate::{
logging::{panic_as_string, TestOutput},
- mullvad_daemon, tests, vm,
+ mullvad_daemon,
+ summary::{self, maybe_log_test_result},
+ tests,
+ tests::{config::TEST_CONFIG, TestContext},
+ vm,
};
use anyhow::{Context, Result};
use futures::FutureExt;
-use std::future::Future;
-use std::panic;
-use std::time::Duration;
-use test_rpc::logging::Output;
-use test_rpc::{mullvad_daemon::MullvadClientVersion, ServiceClient};
+use std::{future::Future, panic, time::Duration};
+use test_rpc::{logging::Output, mullvad_daemon::MullvadClientVersion, ServiceClient};
/// The baud rate of the serial connection between the test manager and the test runner.
/// There is a known issue with setting a baud rate at all or macOS, and the workaround
diff --git a/test/test-manager/src/tests/account.rs b/test/test-manager/src/tests/account.rs
index 80c6272d2a..94374dba20 100644
--- a/test/test-manager/src/tests/account.rs
+++ b/test/test-manager/src/tests/account.rs
@@ -1,13 +1,13 @@
use crate::tests::helpers::{login_with_retries, THROTTLE_RETRY_DELAY};
-use super::config::TEST_CONFIG;
-use super::{helpers, ui, Error, TestContext};
+use super::{config::TEST_CONFIG, helpers, ui, Error, TestContext};
use mullvad_api::DevicesProxy;
use mullvad_management_interface::{client::DaemonEvent, MullvadProxyClient};
-use mullvad_types::device::{Device, DeviceState};
-use mullvad_types::states::TunnelState;
-use std::net::ToSocketAddrs;
-use std::time::Duration;
+use mullvad_types::{
+ device::{Device, DeviceState},
+ states::TunnelState,
+};
+use std::{net::ToSocketAddrs, time::Duration};
use talpid_types::net::wireguard;
use test_macro::test_function;
use test_rpc::ServiceClient;
@@ -19,7 +19,6 @@ pub async fn test_login(
_rpc: ServiceClient,
mut mullvad_client: MullvadProxyClient,
) -> Result<(), Error> {
- //
// Instruct daemon to log in
//
diff --git a/test/test-manager/src/tests/dns.rs b/test/test-manager/src/tests/dns.rs
index 02cadf35ce..bff7059aeb 100644
--- a/test/test-manager/src/tests/dns.rs
+++ b/test/test-manager/src/tests/dns.rs
@@ -17,14 +17,16 @@ use super::{
helpers::{self, connect_and_wait, set_relay_settings},
Error, TestContext,
};
-use crate::network_monitor::{
- start_packet_monitor_until, start_tunnel_packet_monitor_until, Direction, IpHeaderProtocols,
- MonitorOptions,
-};
-use crate::vm::network::{
- CUSTOM_TUN_GATEWAY, CUSTOM_TUN_LOCAL_PRIVKEY, CUSTOM_TUN_LOCAL_TUN_ADDR,
- CUSTOM_TUN_REMOTE_PUBKEY, CUSTOM_TUN_REMOTE_REAL_ADDR, CUSTOM_TUN_REMOTE_REAL_PORT,
- CUSTOM_TUN_REMOTE_TUN_ADDR, NON_TUN_GATEWAY,
+use crate::{
+ network_monitor::{
+ start_packet_monitor_until, start_tunnel_packet_monitor_until, Direction,
+ IpHeaderProtocols, MonitorOptions,
+ },
+ vm::network::{
+ CUSTOM_TUN_GATEWAY, CUSTOM_TUN_LOCAL_PRIVKEY, CUSTOM_TUN_LOCAL_TUN_ADDR,
+ CUSTOM_TUN_REMOTE_PUBKEY, CUSTOM_TUN_REMOTE_REAL_ADDR, CUSTOM_TUN_REMOTE_REAL_PORT,
+ CUSTOM_TUN_REMOTE_TUN_ADDR, NON_TUN_GATEWAY,
+ },
};
/// How long to wait for expected "DNS queries" to appear
@@ -130,7 +132,6 @@ async fn leak_test_dns(
use_tun: bool,
whitelisted_dest: IpAddr,
) -> Result<(), Error> {
- //
// Connect to local wireguard relay
//
@@ -158,7 +159,6 @@ async fn leak_test_dns(
log::debug!("Tunnel (guest) IP: {tunnel_ip}");
log::debug!("Non-tunnel (guest) IP: {nontun_ip}");
- //
// Spoof DNS packets
//
@@ -260,7 +260,6 @@ async fn leak_test_dns(
});
if use_tun {
- //
// Examine tunnel traffic
//
@@ -281,7 +280,6 @@ async fn leak_test_dns(
);
}
- //
// Examine non-tunnel traffic
//
@@ -297,7 +295,6 @@ async fn leak_test_dns(
probes.abort();
let _ = probes.await;
- //
// Examine tunnel traffic
//
@@ -308,7 +305,6 @@ async fn leak_test_dns(
"expected no tunnel packets on port 53"
);
- //
// Examine non-tunnel traffic
//
diff --git a/test/test-manager/src/tests/install.rs b/test/test-manager/src/tests/install.rs
index 7dbf092f5c..cb1ddf58c5 100644
--- a/test/test-manager/src/tests/install.rs
+++ b/test/test-manager/src/tests/install.rs
@@ -1,14 +1,13 @@
-use super::config::TEST_CONFIG;
-use super::helpers::{
- connect_and_wait, get_app_env, get_package_desc, wait_for_tunnel_state, Pinger,
+use super::{
+ config::TEST_CONFIG,
+ helpers::{connect_and_wait, get_app_env, get_package_desc, wait_for_tunnel_state, Pinger},
+ Error, TestContext,
};
-use super::{Error, TestContext};
use mullvad_management_interface::MullvadProxyClient;
use mullvad_types::{constraints::Constraint, relay_constraints};
use test_macro::test_function;
-use test_rpc::meta::Os;
-use test_rpc::{mullvad_daemon::ServiceStatus, ServiceClient};
+use test_rpc::{meta::Os, mullvad_daemon::ServiceStatus, ServiceClient};
use std::time::Duration;
@@ -57,12 +56,11 @@ pub async fn test_upgrade_app(ctx: TestContext, rpc: ServiceClient) -> Result<()
// Login to test preservation of device/account
// TODO: Cannot do this now because overriding the API is impossible for releases
- //mullvad_client
+ // mullvad_client
// .login_account(TEST_CONFIG.account_number.clone())
// .await
// .expect("login failed");
- //
// Start blocking
//
log::debug!("Entering blocking error state");
@@ -95,7 +93,6 @@ pub async fn test_upgrade_app(ctx: TestContext, rpc: ServiceClient) -> Result<()
.await
.map_err(|_error| Error::Daemon(String::from("Failed to enter blocking error state")))?;
- //
// Begin monitoring outgoing traffic and pinging
//
let pinger = Pinger::start(&rpc).await;
@@ -113,7 +110,6 @@ pub async fn test_upgrade_app(ctx: TestContext, rpc: ServiceClient) -> Result<()
return Err(Error::DaemonNotRunning);
}
- //
// Check if any traffic was observed
//
let guest_ip = pinger.guest_ip;
@@ -157,17 +153,15 @@ pub async fn test_upgrade_app(ctx: TestContext, rpc: ServiceClient) -> Result<()
// check if account history was preserved
// TODO: Cannot check account history because overriding the API is impossible for releases
- /*
- let history = mullvad_client
- .get_account_history(())
- .await
- .expect("failed to obtain account history");
- assert_eq!(
- history.into_inner().token,
- Some(TEST_CONFIG.account_number.clone()),
- "lost account history"
- );
- */
+ // let history = mullvad_client
+ // .get_account_history(())
+ // .await
+ // .expect("failed to obtain account history");
+ // assert_eq!(
+ // history.into_inner().token,
+ // Some(TEST_CONFIG.account_number.clone()),
+ // "lost account history"
+ // );
Ok(())
}
diff --git a/test/test-manager/src/tests/relay_ip_overrides.rs b/test/test-manager/src/tests/relay_ip_overrides.rs
index 4108c5dbbe..48df8ff0e4 100644
--- a/test/test-manager/src/tests/relay_ip_overrides.rs
+++ b/test/test-manager/src/tests/relay_ip_overrides.rs
@@ -4,8 +4,10 @@ use super::{
helpers::{self, AbortOnDrop},
TestContext,
};
-use crate::vm;
-use crate::vm::network::linux::{NON_TUN_GATEWAY, TEST_SUBNET};
+use crate::{
+ vm,
+ vm::network::linux::{NON_TUN_GATEWAY, TEST_SUBNET},
+};
use anyhow::{anyhow, bail, ensure, Context};
use futures::FutureExt;
use mullvad_management_interface::MullvadProxyClient;
diff --git a/test/test-manager/src/tests/settings.rs b/test/test-manager/src/tests/settings.rs
index 2b488dea22..6d1ade18c7 100644
--- a/test/test-manager/src/tests/settings.rs
+++ b/test/test-manager/src/tests/settings.rs
@@ -1,8 +1,9 @@
-use super::helpers;
-use super::helpers::{connect_and_wait, send_guest_probes};
-use super::{Error, TestContext};
-use crate::assert_tunnel_state;
-use crate::vm::network::DUMMY_LAN_INTERFACE_IP;
+use super::{
+ helpers,
+ helpers::{connect_and_wait, send_guest_probes},
+ Error, TestContext,
+};
+use crate::{assert_tunnel_state, vm::network::DUMMY_LAN_INTERFACE_IP};
use mullvad_management_interface::MullvadProxyClient;
use mullvad_types::states::TunnelState;
@@ -23,13 +24,11 @@ pub async fn test_lan(
) -> Result<(), Error> {
let lan_destination = SocketAddr::new(IpAddr::V4(DUMMY_LAN_INTERFACE_IP), 1234);
- //
// Connect
//
connect_and_wait(&mut mullvad_client).await?;
- //
// Disable LAN sharing
//
@@ -40,7 +39,6 @@ pub async fn test_lan(
.await
.expect("failed to disable LAN sharing");
- //
// Ensure LAN is not reachable
//
@@ -54,7 +52,6 @@ pub async fn test_lan(
"observed unexpected outgoing LAN packets: {detected_probes:?}"
);
- //
// Enable LAN sharing
//
@@ -65,7 +62,6 @@ pub async fn test_lan(
.await
.expect("failed to enable LAN sharing");
- //
// Ensure LAN is reachable
//
@@ -83,13 +79,10 @@ pub async fn test_lan(
/// Enable lockdown mode. This test succeeds if:
///
-/// * Disconnected state: Outgoing traffic leaks (UDP/TCP/ICMP)
-/// cannot be produced.
-/// * Disconnected state: Outgoing traffic to a single
-/// private IP can be produced, if and only if LAN
-/// sharing is enabled.
-/// * Connected state: Outgoing traffic leaks (UDP/TCP/ICMP)
-/// cannot be produced.
+/// * Disconnected state: Outgoing traffic leaks (UDP/TCP/ICMP) cannot be produced.
+/// * Disconnected state: Outgoing traffic to a single private IP can be produced, if and only if
+/// LAN sharing is enabled.
+/// * Connected state: Outgoing traffic leaks (UDP/TCP/ICMP) cannot be produced.
///
/// # Limitations
///
@@ -116,7 +109,6 @@ pub async fn test_lockdown(
.await
.expect("failed to enable lockdown mode");
- //
// Disable LAN sharing
//
@@ -127,7 +119,6 @@ pub async fn test_lockdown(
.await
.expect("failed to disable LAN sharing");
- //
// Ensure all destinations are unreachable
//
@@ -147,7 +138,6 @@ pub async fn test_lockdown(
"observed outgoing packets to internet: {detected_probes:?}"
);
- //
// Enable LAN sharing
//
@@ -158,7 +148,6 @@ pub async fn test_lockdown(
.await
.expect("failed to enable LAN sharing");
- //
// Ensure private IPs are reachable, but not others
//
@@ -176,13 +165,11 @@ pub async fn test_lockdown(
"observed outgoing packets to internet: {detected_probes:?}"
);
- //
// Connect
//
connect_and_wait(&mut mullvad_client).await?;
- //
// Leak test
//
@@ -200,7 +187,6 @@ pub async fn test_lockdown(
"observed outgoing packets to internet: {detected_probes:?}"
);
- //
// Disable lockdown mode
//
mullvad_client
diff --git a/test/test-manager/src/tests/test_metadata.rs b/test/test-manager/src/tests/test_metadata.rs
index d4ffa9bfd0..474ad0a566 100644
--- a/test/test-manager/src/tests/test_metadata.rs
+++ b/test/test-manager/src/tests/test_metadata.rs
@@ -1,6 +1,5 @@
use super::TestWrapperFunction;
-use test_rpc::meta::Os;
-use test_rpc::mullvad_daemon::MullvadClientVersion;
+use test_rpc::{meta::Os, mullvad_daemon::MullvadClientVersion};
pub struct TestMetadata {
pub name: &'static str,
diff --git a/test/test-manager/src/tests/tunnel.rs b/test/test-manager/src/tests/tunnel.rs
index e4bf35bc7a..a0acbf2114 100644
--- a/test/test-manager/src/tests/tunnel.rs
+++ b/test/test-manager/src/tests/tunnel.rs
@@ -1,9 +1,14 @@
-use super::helpers::{
- self, connect_and_wait, disconnect_and_wait, set_bridge_settings, set_relay_settings,
+use super::{
+ config::TEST_CONFIG,
+ helpers::{
+ self, connect_and_wait, disconnect_and_wait, set_bridge_settings, set_relay_settings,
+ },
+ Error, TestContext,
+};
+use crate::{
+ network_monitor::{start_packet_monitor, MonitorOptions},
+ tests::helpers::login_with_retries,
};
-use super::{config::TEST_CONFIG, Error, TestContext};
-use crate::network_monitor::{start_packet_monitor, MonitorOptions};
-use crate::tests::helpers::login_with_retries;
use mullvad_management_interface::MullvadProxyClient;
use mullvad_relay_selector::query::builder::RelayQueryBuilder;
@@ -22,9 +27,7 @@ use talpid_types::net::{
TransportProtocol, TunnelType,
};
use test_macro::test_function;
-use test_rpc::meta::Os;
-use test_rpc::mullvad_daemon::ServiceStatus;
-use test_rpc::ServiceClient;
+use test_rpc::{meta::Os, mullvad_daemon::ServiceStatus, ServiceClient};
use pnet_packet::ip::IpNextHeaderProtocols;
@@ -168,7 +171,6 @@ pub async fn test_udp2tcp_tunnel(
_ => panic!("unexpected tunnel state"),
};
- //
// Set up packet monitor
//
@@ -181,7 +183,6 @@ pub async fn test_udp2tcp_tunnel(
)
.await;
- //
// Verify that we can reach stuff
//
@@ -200,8 +201,7 @@ pub async fn test_udp2tcp_tunnel(
}
/// Test whether bridge mode works. This fails if:
-/// * No outgoing traffic to the bridge/entry relay is
-/// observed from the SUT.
+/// * No outgoing traffic to the bridge/entry relay is observed from the SUT.
/// * The conncheck reports an unexpected exit relay.
#[test_function]
pub async fn test_bridge(
@@ -209,7 +209,6 @@ pub async fn test_bridge(
rpc: ServiceClient,
mut mullvad_client: MullvadProxyClient,
) -> Result<(), Error> {
- //
// Enable bridge mode
//
log::info!("Updating bridge settings");
@@ -233,7 +232,6 @@ pub async fn test_bridge(
.await
.expect("failed to update relay settings");
- //
// Connect to VPN
//
@@ -264,7 +262,6 @@ pub async fn test_bridge(
)
.await;
- //
// Verify exit IP
//
@@ -275,7 +272,6 @@ pub async fn test_bridge(
"expected Mullvad exit IP"
);
- //
// Verify entry IP
//
@@ -311,7 +307,6 @@ pub async fn test_multihop(
.await
.expect("failed to update relay settings");
- //
// Connect
//
@@ -334,7 +329,6 @@ pub async fn test_multihop(
exit_addr = exit.address
);
- //
// Record outgoing packets to the entry relay
//
@@ -344,7 +338,6 @@ pub async fn test_multihop(
)
.await;
- //
// Verify exit IP
//
@@ -353,7 +346,6 @@ pub async fn test_multihop(
"expected Mullvad exit IP"
);
- //
// Verify entry IP
//
@@ -468,7 +460,6 @@ pub async fn test_quantum_resistant_tunnel(
.await
.expect("Failed to disable PQ tunnels");
- //
// PQ disabled: Find no "preshared key"
//
@@ -490,7 +481,6 @@ pub async fn test_quantum_resistant_tunnel(
.await
.expect("Failed to enable PQ tunnels");
- //
// PQ enabled: Find "preshared key"
//
@@ -614,7 +604,6 @@ pub async fn test_remote_socks_bridge(
.await
.expect("failed to update relay settings");
- //
// Connect to VPN
//
@@ -643,7 +632,6 @@ pub async fn test_remote_socks_bridge(
)
.await;
- //
// Verify exit IP
//
@@ -654,7 +642,6 @@ pub async fn test_remote_socks_bridge(
"expected Mullvad exit IP"
);
- //
// Verify entry IP
//
@@ -717,7 +704,6 @@ pub async fn test_local_socks_bridge(
.await
.expect("failed to update relay settings");
- //
// Connect to VPN
//
@@ -746,7 +732,6 @@ pub async fn test_local_socks_bridge(
)
.await;
- //
// Verify exit IP
//
@@ -757,7 +742,6 @@ pub async fn test_local_socks_bridge(
"expected Mullvad exit IP"
);
- //
// Verify entry IP
//
@@ -773,7 +757,8 @@ pub async fn test_local_socks_bridge(
}
/// Verify that the app can connect to a VPN server and get working internet when the API is down.
-/// As long as the user has managed to log in to the app, establishing a tunnel should work even if the API is down (This includes actually being down, not just censored).
+/// As long as the user has managed to log in to the app, establishing a tunnel should work even if
+/// the API is down (This includes actually being down, not just censored).
///
/// The test procedure is as follows:
/// 1. The app is logged in
diff --git a/test/test-manager/src/tests/ui.rs b/test/test-manager/src/tests/ui.rs
index 6cac7d0d5e..ebd6fb3ee9 100644
--- a/test/test-manager/src/tests/ui.rs
+++ b/test/test-manager/src/tests/ui.rs
@@ -1,9 +1,9 @@
-use super::config::TEST_CONFIG;
-use super::helpers;
-use super::{Error, TestContext};
+use super::{config::TEST_CONFIG, helpers, Error, TestContext};
use mullvad_management_interface::MullvadProxyClient;
-use mullvad_types::relay_constraints::{RelayConstraints, RelaySettings};
-use mullvad_types::relay_list::{Relay, RelayEndpointData};
+use mullvad_types::{
+ relay_constraints::{RelayConstraints, RelaySettings},
+ relay_list::{Relay, RelayEndpointData},
+};
use std::{
collections::BTreeMap,
fmt::Debug,
@@ -58,7 +58,7 @@ pub async fn run_test_env<
.collect();
// env may contain sensitive info
- //log::info!("Running UI tests: {params:?}, env: {env:?}");
+ // log::info!("Running UI tests: {params:?}, env: {env:?}");
log::info!("Running UI tests: {params:?}");
let result = rpc
diff --git a/test/test-manager/src/vm/provision.rs b/test/test-manager/src/vm/provision.rs
index 8667b6c133..aa8949d54f 100644
--- a/test/test-manager/src/vm/provision.rs
+++ b/test/test-manager/src/vm/provision.rs
@@ -1,12 +1,15 @@
-use crate::config::{OsType, Provisioner, VmConfig};
-use crate::package;
+use crate::{
+ config::{OsType, Provisioner, VmConfig},
+ package,
+};
use anyhow::{bail, Context, Result};
use ssh2::Session;
-use std::fs::File;
-use std::io::{self, Read};
-use std::net::IpAddr;
-use std::net::TcpStream;
-use std::{net::SocketAddr, path::Path};
+use std::{
+ fs::File,
+ io::{self, Read},
+ net::{IpAddr, SocketAddr, TcpStream},
+ path::Path,
+};
pub async fn provision(
config: &VmConfig,
diff --git a/test/test-manager/src/vm/ssh.rs b/test/test-manager/src/vm/ssh.rs
index 008045fc2b..f75fd39c53 100644
--- a/test/test-manager/src/vm/ssh.rs
+++ b/test/test-manager/src/vm/ssh.rs
@@ -1,8 +1,10 @@
/// A very thin wrapper on top of `ssh2`.
use anyhow::{Context, Result};
use ssh2::Session;
-use std::io::Read;
-use std::net::{IpAddr, SocketAddr, TcpStream};
+use std::{
+ io::Read,
+ net::{IpAddr, SocketAddr, TcpStream},
+};
/// Default `ssh` port.
const PORT: u16 = 22;
diff --git a/test/test-manager/src/vm/tart.rs b/test/test-manager/src/vm/tart.rs
index 1df55845ed..407a4903c2 100644
--- a/test/test-manager/src/vm/tart.rs
+++ b/test/test-manager/src/vm/tart.rs
@@ -63,7 +63,7 @@ pub async fn run(config: &Config, vm_config: &VmConfig) -> Result<TartInstance>
}
config::Display::Local => (),
config::Display::Vnc => {
- //tart_cmd.args(["--vnc-experimental", "--no-graphics"]);
+ // tart_cmd.args(["--vnc-experimental", "--no-graphics"]);
tart_cmd.args(["--vnc", "--no-graphics"]);
}
}
diff --git a/test/test-manager/src/vm/update.rs b/test/test-manager/src/vm/update.rs
index ccc0c9b4a3..1d478b7fa5 100644
--- a/test/test-manager/src/vm/update.rs
+++ b/test/test-manager/src/vm/update.rs
@@ -1,5 +1,7 @@
-use crate::config::{OsType, PackageType, Provisioner, VmConfig};
-use crate::vm::ssh::SSHSession;
+use crate::{
+ config::{OsType, PackageType, Provisioner, VmConfig},
+ vm::ssh::SSHSession,
+};
use anyhow::{Context, Result};
use std::fmt;
diff --git a/test/test-manager/test_macro/src/lib.rs b/test/test-manager/test_macro/src/lib.rs
index 7cb8407230..161605e8ca 100644
--- a/test/test-manager/test_macro/src/lib.rs
+++ b/test/test-manager/test_macro/src/lib.rs
@@ -18,7 +18,7 @@ use test_rpc::meta::Os;
/// defined in [`mullvad_management_interface::MullvadProxyClient`] are
/// available on `mullvad_client`.
///
-///# Arguments
+/// # Arguments
///
/// The `test_function` macro takes 4 optional arguments
///
diff --git a/test/test-runner/src/forward.rs b/test/test-runner/src/forward.rs
index ec9e8a98f1..a4c80ae189 100644
--- a/test/test-runner/src/forward.rs
+++ b/test/test-runner/src/forward.rs
@@ -1,11 +1,14 @@
use once_cell::sync::Lazy;
-use std::collections::HashMap;
-use std::net::SocketAddr;
-use std::sync::atomic::{AtomicUsize, Ordering};
-use std::sync::{Arc, Mutex};
+use std::{
+ collections::HashMap,
+ net::SocketAddr,
+ sync::{
+ atomic::{AtomicUsize, Ordering},
+ Arc, Mutex,
+ },
+};
use test_rpc::net::SockHandleId;
-use tokio::net::TcpListener;
-use tokio::net::TcpStream;
+use tokio::net::{TcpListener, TcpStream};
static SERVERS: Lazy<Mutex<HashMap<SockHandleId, Handle>>> =
Lazy::new(|| Mutex::new(HashMap::new()));
diff --git a/test/test-runner/src/logging.rs b/test/test-runner/src/logging.rs
index 98f033e13a..ffe21de985 100644
--- a/test/test-runner/src/logging.rs
+++ b/test/test-runner/src/logging.rs
@@ -1,9 +1,10 @@
use log::{Level, LevelFilter, Metadata, Record, SetLoggerError};
use once_cell::sync::Lazy;
-use std::ffi::OsStr;
-use std::path::{Path, PathBuf};
-use test_rpc::logging::Error;
-use test_rpc::logging::{LogFile, LogOutput, Output};
+use std::{
+ ffi::OsStr,
+ path::{Path, PathBuf},
+};
+use test_rpc::logging::{Error, LogFile, LogOutput, Output};
use tokio::{
fs::File,
io::{self, AsyncBufReadExt, BufReader},
diff --git a/test/test-runner/src/sys.rs b/test/test-runner/src/sys.rs
index 7576c64e89..5015f26ca1 100644
--- a/test/test-runner/src/sys.rs
+++ b/test/test-runner/src/sys.rs
@@ -1,8 +1,7 @@
use std::collections::HashMap;
#[cfg(target_os = "windows")]
use std::io;
-use test_rpc::meta::OsVersion;
-use test_rpc::mullvad_daemon::Verbosity;
+use test_rpc::{meta::OsVersion, mullvad_daemon::Verbosity};
#[cfg(target_os = "windows")]
use std::ffi::OsString;
@@ -14,11 +13,13 @@ use windows_service::{
#[cfg(target_os = "windows")]
pub fn reboot() -> Result<(), test_rpc::Error> {
- use windows_sys::Win32::System::Shutdown::{
- ExitWindowsEx, EWX_REBOOT, SHTDN_REASON_FLAG_PLANNED, SHTDN_REASON_MAJOR_APPLICATION,
- SHTDN_REASON_MINOR_OTHER,
+ use windows_sys::Win32::{
+ System::Shutdown::{
+ ExitWindowsEx, EWX_REBOOT, SHTDN_REASON_FLAG_PLANNED, SHTDN_REASON_MAJOR_APPLICATION,
+ SHTDN_REASON_MINOR_OTHER,
+ },
+ UI::WindowsAndMessaging::EWX_FORCEIFHUNG,
};
- use windows_sys::Win32::UI::WindowsAndMessaging::EWX_FORCEIFHUNG;
grant_shutdown_privilege()?;
@@ -52,18 +53,17 @@ pub fn reboot() -> Result<(), test_rpc::Error> {
#[cfg(target_os = "windows")]
fn grant_shutdown_privilege() -> Result<(), test_rpc::Error> {
- use windows_sys::Win32::Foundation::CloseHandle;
- use windows_sys::Win32::Foundation::HANDLE;
- use windows_sys::Win32::Foundation::LUID;
- use windows_sys::Win32::Security::AdjustTokenPrivileges;
- use windows_sys::Win32::Security::LookupPrivilegeValueW;
- use windows_sys::Win32::Security::LUID_AND_ATTRIBUTES;
- use windows_sys::Win32::Security::SE_PRIVILEGE_ENABLED;
- use windows_sys::Win32::Security::TOKEN_ADJUST_PRIVILEGES;
- use windows_sys::Win32::Security::TOKEN_PRIVILEGES;
- use windows_sys::Win32::System::SystemServices::SE_SHUTDOWN_NAME;
- use windows_sys::Win32::System::Threading::GetCurrentProcess;
- use windows_sys::Win32::System::Threading::OpenProcessToken;
+ use windows_sys::Win32::{
+ Foundation::{CloseHandle, HANDLE, LUID},
+ Security::{
+ AdjustTokenPrivileges, LookupPrivilegeValueW, LUID_AND_ATTRIBUTES,
+ SE_PRIVILEGE_ENABLED, TOKEN_ADJUST_PRIVILEGES, TOKEN_PRIVILEGES,
+ },
+ System::{
+ SystemServices::SE_SHUTDOWN_NAME,
+ Threading::{GetCurrentProcess, OpenProcessToken},
+ },
+ };
let mut privileges = TOKEN_PRIVILEGES {
PrivilegeCount: 1,
@@ -458,8 +458,7 @@ pub async fn set_daemon_environment(env: HashMap<String, String>) -> Result<(),
#[cfg(target_os = "windows")]
pub fn get_system_path_var() -> Result<String, test_rpc::Error> {
- use winreg::enums::*;
- use winreg::*;
+ use winreg::{enums::*, *};
let hklm = RegKey::predef(HKEY_LOCAL_MACHINE);
let key = hklm