summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test-manager/src/container.rs2
-rw-r--r--test/test-manager/src/logging.rs2
-rw-r--r--test/test-manager/src/mullvad_daemon.rs2
-rw-r--r--test/test-manager/src/run_tests.rs2
-rw-r--r--test/test-manager/src/summary.rs4
-rw-r--r--test/test-manager/src/tests/helpers.rs13
-rw-r--r--test/test-manager/src/tests/install.rs6
-rw-r--r--test/test-manager/src/tests/tunnel_state.rs5
-rw-r--r--test/test-manager/src/vm/network/linux.rs2
-rw-r--r--test/test-rpc/src/transport.rs2
-rw-r--r--test/test-runner/src/logging.rs6
-rw-r--r--test/test-runner/src/sys.rs17
12 files changed, 28 insertions, 35 deletions
diff --git a/test/test-manager/src/container.rs b/test/test-manager/src/container.rs
index 19cde03ee4..88ba7d9a6b 100644
--- a/test/test-manager/src/container.rs
+++ b/test/test-manager/src/container.rs
@@ -29,7 +29,7 @@ pub async fn relaunch_with_rootlesskit(vnc_port: Option<u16>) {
cmd.args(std::env::args());
let status = cmd.status().await.unwrap_or_else(|e| {
- panic!("failed to execute [{:?}]: {}", cmd, e);
+ panic!("failed to execute [{cmd:?}]: {e}");
});
std::process::exit(status.code().unwrap_or(1));
diff --git a/test/test-manager/src/logging.rs b/test/test-manager/src/logging.rs
index 4f7d6e1e91..75b3d3f5cd 100644
--- a/test/test-manager/src/logging.rs
+++ b/test/test-manager/src/logging.rs
@@ -219,7 +219,7 @@ impl TestOutput {
format!(
"TEST {} RETURNED ERROR: {}",
self.test_name,
- format!("{:?}", e).bold()
+ format!("{e:?}").bold()
)
.red()
);
diff --git a/test/test-manager/src/mullvad_daemon.rs b/test/test-manager/src/mullvad_daemon.rs
index 8da149d329..f035c244bf 100644
--- a/test/test-manager/src/mullvad_daemon.rs
+++ b/test/test-manager/src/mullvad_daemon.rs
@@ -38,7 +38,7 @@ impl<Request> Service<Request> for DummyService {
Box::pin(async move {
notifier_tx
.unbounded_send(TokioIo::new(channel_in))
- .map_err(|_| io::Error::new(io::ErrorKind::Other, "stream receiver is down"))?;
+ .map_err(|_| io::Error::other("stream receiver is down"))?;
Ok(TokioIo::new(channel_out))
})
}
diff --git a/test/test-manager/src/run_tests.rs b/test/test-manager/src/run_tests.rs
index 54e563f704..513a10be71 100644
--- a/test/test-manager/src/run_tests.rs
+++ b/test/test-manager/src/run_tests.rs
@@ -232,7 +232,7 @@ where
output.append(&mut output_after_test);
}
Err(e) => {
- output.push(Output::Other(format!("could not get logs: {:?}", e)));
+ output.push(Output::Other(format!("could not get logs: {e:?}")));
}
}
}
diff --git a/test/test-manager/src/summary.rs b/test/test-manager/src/summary.rs
index f0c0723c48..373235caf6 100644
--- a/test/test-manager/src/summary.rs
+++ b/test/test-manager/src/summary.rs
@@ -210,7 +210,7 @@ pub async fn print_summary_table<P: AsRef<Path>>(summary_files: &[P]) {
let counter_text = if total_passed == total_tests {
String::from(TestResult::PASS_STR)
} else {
- format!("({}/{})", total_passed, total_tests)
+ format!("({total_passed}/{total_tests})")
};
println!(
"<td style='text-align: center;'>{} {}</td>",
@@ -266,7 +266,7 @@ pub async fn print_summary_table<P: AsRef<Path>>(summary_files: &[P]) {
}
TestResult::Pass | TestResult::Skip => (),
}
- println!("<td style='text-align: center;'>{}</td>", result);
+ println!("<td style='text-align: center;'>{result}</td>");
}
// Print a summary of all OSes at the end of the table
// For each test, collect the result for each platform.
diff --git a/test/test-manager/src/tests/helpers.rs b/test/test-manager/src/tests/helpers.rs
index 5dcb8d0d0c..aef29578d0 100644
--- a/test/test-manager/src/tests/helpers.rs
+++ b/test/test-manager/src/tests/helpers.rs
@@ -488,12 +488,12 @@ pub async fn wait_for_tunnel_state(
let events = rpc
.events_listen()
.await
- .map_err(|status| Error::Daemon(format!("Failed to get event stream: {}", status)))?;
+ .map_err(|status| Error::Daemon(format!("Failed to get event stream: {status}")))?;
let state = rpc
.get_tunnel_state()
.await
- .map_err(|error| Error::Daemon(format!("Failed to get tunnel state: {:?}", error)))?;
+ .map_err(|error| Error::Daemon(format!("Failed to get tunnel state: {error:?}")))?;
if accept_state_fn(&state) {
return Ok(state);
@@ -533,10 +533,7 @@ where
None => continue,
},
Some(Err(status)) => {
- break Err(Error::Daemon(format!(
- "Failed to get next event: {}",
- status
- )));
+ break Err(Error::Daemon(format!("Failed to get next event: {status}")));
}
None => break Err(Error::Daemon(String::from("Lost daemon event stream"))),
}
@@ -646,7 +643,7 @@ pub async fn set_custom_endpoint(
mullvad_client
.set_relay_settings(RelaySettings::CustomTunnelEndpoint(custom_endpoint))
.await
- .map_err(|error| Error::Daemon(format!("Failed to set relay settings: {}", error)))
+ .map_err(|error| Error::Daemon(format!("Failed to set relay settings: {error}")))
}
pub async fn update_relay_constraints(
@@ -1322,7 +1319,7 @@ pub async fn set_location(
let mut settings = mullvad_client
.get_settings()
.await
- .map_err(|error| Error::Daemon(format!("Failed to set relay settings: {}", error)))?;
+ .map_err(|error| Error::Daemon(format!("Failed to set relay settings: {error}")))?;
settings.bridge_settings.normal.location = Constraint::Only(location_constraint.clone());
mullvad_client
diff --git a/test/test-manager/src/tests/install.rs b/test/test-manager/src/tests/install.rs
index 0639694986..4c0195f3a5 100644
--- a/test/test-manager/src/tests/install.rs
+++ b/test/test-manager/src/tests/install.rs
@@ -230,8 +230,7 @@ pub async fn test_uninstall_app(
assert!(
!devices.iter().any(|device| device.id == uninstalled_device),
- "device id {} still exists after uninstall",
- uninstalled_device,
+ "device id {uninstalled_device} still exists after uninstall",
);
Ok(())
@@ -280,8 +279,7 @@ pub async fn test_detect_app_removal(
.expect("failed to list devices");
assert!(
!devices.iter().any(|device| device.id == uninstalled_device),
- "device id {} still exists after uninstall",
- uninstalled_device,
+ "device id {uninstalled_device} still exists after uninstall",
);
return Ok(());
diff --git a/test/test-manager/src/tests/tunnel_state.rs b/test/test-manager/src/tests/tunnel_state.rs
index 60f266721e..9b83e65ff8 100644
--- a/test/test-manager/src/tests/tunnel_state.rs
+++ b/test/test-manager/src/tests/tunnel_state.rs
@@ -210,8 +210,7 @@ pub async fn test_connecting_state(
assert!(
matches!(new_state, TunnelState::Connecting { .. }),
- "failed to enter connecting state: {:?}",
- new_state
+ "failed to enter connecting state: {new_state:?}"
);
// Leak test
@@ -373,7 +372,7 @@ pub async fn test_connected_state(
} => {
assert_eq!(*addr.ip(), relay.ipv4_addr_in);
}
- actual => panic!("unexpected tunnel state: {:?}", actual),
+ actual => panic!("unexpected tunnel state: {actual:?}"),
}
// Ping outside of tunnel while connected
diff --git a/test/test-manager/src/vm/network/linux.rs b/test/test-manager/src/vm/network/linux.rs
index f5ed523655..ef7eebeb2a 100644
--- a/test/test-manager/src/vm/network/linux.rs
+++ b/test/test-manager/src/vm/network/linux.rs
@@ -204,7 +204,7 @@ async fn start_dnsmasq() -> Result<DhcpProcHandle> {
"-i",
BRIDGE_NAME,
"-F",
- &format!("{},{}", TEST_SUBNET_DHCP_FIRST, TEST_SUBNET_DHCP_LAST),
+ &format!("{TEST_SUBNET_DHCP_FIRST},{TEST_SUBNET_DHCP_LAST}"),
"--no-hosts",
"--keep-in-foreground",
"--log-facility=-",
diff --git a/test/test-rpc/src/transport.rs b/test/test-rpc/src/transport.rs
index f5f4617026..ffdefbf923 100644
--- a/test/test-rpc/src/transport.rs
+++ b/test/test-rpc/src/transport.rs
@@ -486,7 +486,7 @@ fn display_chain(error: impl std::error::Error) -> String {
let mut s = error.to_string();
let mut error = &error as &dyn std::error::Error;
while let Some(source) = error.source() {
- write!(&mut s, "\nCaused by: {}", source).unwrap();
+ write!(&mut s, "\nCaused by: {source}").unwrap();
error = source;
}
s
diff --git a/test/test-runner/src/logging.rs b/test/test-runner/src/logging.rs
index 6ca19c2c63..bab3693c34 100644
--- a/test/test-runner/src/logging.rs
+++ b/test/test-runner/src/logging.rs
@@ -76,7 +76,7 @@ pub async fn get_mullvad_app_logs() -> LogOutput {
async fn read_settings_file() -> Result<String, Error> {
let mut settings_path = mullvad_paths::get_default_settings_dir()
- .map_err(|error| Error::Logs(format!("{}", error)))?;
+ .map_err(|error| Error::Logs(format!("{error}")))?;
settings_path.push("settings.json");
read_truncated(&settings_path, None)
.await
@@ -85,10 +85,10 @@ async fn read_settings_file() -> Result<String, Error> {
async fn read_log_files() -> Result<Vec<Result<LogFile, Error>>, Error> {
let log_dir =
- mullvad_paths::get_default_log_dir().map_err(|error| Error::Logs(format!("{}", error)))?;
+ mullvad_paths::get_default_log_dir().map_err(|error| Error::Logs(format!("{error}")))?;
let paths = list_logs(log_dir)
.await
- .map_err(|error| Error::Logs(format!("{}", error)))?;
+ .map_err(|error| Error::Logs(format!("{error}")))?;
let mut log_files = Vec::new();
for path in paths {
let log_file = read_truncated(&path, Some(TRUNCATE_LOG_FILE_LINES))
diff --git a/test/test-runner/src/sys.rs b/test/test-runner/src/sys.rs
index 5f461f9013..024e1153c9 100644
--- a/test/test-runner/src/sys.rs
+++ b/test/test-runner/src/sys.rs
@@ -505,11 +505,11 @@ pub async fn set_daemon_environment(env: HashMap<String, String>) -> Result<(),
let hklm = RegKey::predef(HKEY_LOCAL_MACHINE);
let path = Path::new(MULLVAD_WIN_REGISTRY).join("Environment");
let (registry, _) = hklm.create_subkey(&path).map_err(|error| {
- test_rpc::Error::Registry(format!("Failed to open Mullvad VPN subkey: {}", error))
+ test_rpc::Error::Registry(format!("Failed to open Mullvad VPN subkey: {error}"))
})?;
for (k, v) in env {
registry.set_value(k, &v).map_err(|error| {
- test_rpc::Error::Registry(format!("Failed to set Environment var: {}", error))
+ test_rpc::Error::Registry(format!("Failed to set Environment var: {error}"))
})?;
}
@@ -528,12 +528,12 @@ pub fn get_system_path_var() -> Result<String, test_rpc::Error> {
let key = hklm
.open_subkey("SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment")
.map_err(|error| {
- test_rpc::Error::Registry(format!("Failed to open Environment subkey: {}", error))
+ test_rpc::Error::Registry(format!("Failed to open Environment subkey: {error}"))
})?;
let path: String = key
.get_value("Path")
- .map_err(|error| test_rpc::Error::Registry(format!("Failed to get PATH: {}", error)))?;
+ .map_err(|error| test_rpc::Error::Registry(format!("Failed to get PATH: {error}")))?;
Ok(path)
}
@@ -642,7 +642,7 @@ pub async fn get_daemon_environment() -> Result<HashMap<String, String>, test_rp
tokio::task::spawn_blocking(|| -> Result<HashMap<String, String>, test_rpc::Error> {
let hklm = RegKey::predef(HKEY_LOCAL_MACHINE);
let key = hklm.open_subkey(MULLVAD_WIN_REGISTRY).map_err(|error| {
- test_rpc::Error::Registry(format!("Failed to open Mullvad VPN subkey: {}", error))
+ test_rpc::Error::Registry(format!("Failed to open Mullvad VPN subkey: {error}"))
})?;
// The Strings will be quoted (surrounded by ") when read from the registry - we should
@@ -651,10 +651,9 @@ pub async fn get_daemon_environment() -> Result<HashMap<String, String>, test_rp
let env = key
.open_subkey("Environment")
.map_err(|error| {
- test_rpc::Error::Registry(format!(
- "Failed to open Environment subkey: {}",
- error
- ))
+ test_rpc::Error::Registry(
+ format!("Failed to open Environment subkey: {error}",),
+ )
})?
.enum_values()
.filter_map(|x| x.inspect_err(|err| log::trace!("{err}")).ok())