summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJoakim Hulthe <joakim@hulthe.net>2025-08-19 10:48:25 +0200
committerJoakim Hulthe <joakim.hulthe@mullvad.net>2025-08-19 13:07:09 +0200
commit0c464f991ef9b66ef88439c0e0fb1849bd5f1ec2 (patch)
tree68246f4ab6cbcac53ce13b7c9af577c85cb55167
parent589e1dff65746b7e14d8081beaa4d716ced1a54f (diff)
downloadmullvadvpn-0c464f991ef9b66ef88439c0e0fb1849bd5f1ec2.tar.xz
mullvadvpn-0c464f991ef9b66ef88439c0e0fb1849bd5f1ec2.zip
Add --skip flag to test-manager
-rw-r--r--test/test-manager/src/main.rs7
-rw-r--r--test/test-manager/src/tests/mod.rs16
2 files changed, 20 insertions, 3 deletions
diff --git a/test/test-manager/src/main.rs b/test/test-manager/src/main.rs
index d1b9b1fcb4..c9bc45b0a3 100644
--- a/test/test-manager/src/main.rs
+++ b/test/test-manager/src/main.rs
@@ -114,6 +114,10 @@ enum Commands {
#[arg(long)]
openvpn_certificate: Option<PathBuf>,
+ /// Names of tests to not run. Any tests given here will be skipped.
+ #[arg(long)]
+ skip: Vec<String>,
+
/// Names of tests to run. The order given will be respected. If not set, all tests will be
/// run.
test_filters: Vec<String>,
@@ -285,6 +289,7 @@ async fn main() -> Result<()> {
gui_package,
package_dir,
openvpn_certificate,
+ skip,
test_filters,
verbose,
test_report,
@@ -369,7 +374,7 @@ async fn main() -> Result<()> {
openvpn_certificate,
));
- let mut tests = get_filtered_tests(&test_filters)?;
+ let mut tests = get_filtered_tests(&test_filters, &skip)?;
for test in tests.iter_mut() {
test.location = config.test_locations.lookup(test.name).cloned();
}
diff --git a/test/test-manager/src/tests/mod.rs b/test/test-manager/src/tests/mod.rs
index 76d3a4bb48..1981cc0e07 100644
--- a/test/test-manager/src/tests/mod.rs
+++ b/test/test-manager/src/tests/mod.rs
@@ -23,7 +23,7 @@ pub use test_metadata::TestMetadata;
use anyhow::Context;
use futures::future::BoxFuture;
-use std::time::Duration;
+use std::{ops::Not, time::Duration};
use crate::{mullvad_daemon::RpcClientProvider, package::get_version_from_path};
use config::TEST_CONFIG;
@@ -112,7 +112,10 @@ pub fn get_test_descriptions() -> Vec<TestDescription> {
/// Return all tests with names matching the input argument. Filters out tests that are skipped for
/// the target platform and `test_upgrade_app`, which is run separately.
-pub fn get_filtered_tests(specified_tests: &[String]) -> Result<Vec<TestMetadata>, anyhow::Error> {
+pub fn get_filtered_tests(
+ specified_tests: &[String],
+ skipped_tests: &[String],
+) -> Result<Vec<TestMetadata>, anyhow::Error> {
let mut tests: Vec<_> = inventory::iter::<TestMetadata>().cloned().collect();
tests.sort_by_key(|test| test.priority.unwrap_or(0));
@@ -131,7 +134,16 @@ pub fn get_filtered_tests(specified_tests: &[String]) -> Result<Vec<TestMetadata
})
.collect::<Result<_, anyhow::Error>>()?
};
+
+ tests.retain(|test| {
+ skipped_tests
+ .iter()
+ .any(|skip| skip.eq_ignore_ascii_case(test.name))
+ .not()
+ });
+
tests.retain(|test| should_run_on_os(test.targets, TEST_CONFIG.os));
+
Ok(tests)
}