summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorSebastian Holmin <sebastian.holmin@mullvad.net>2024-08-08 10:48:08 +0200
committerSebastian Holmin <sebastian.holmin@mullvad.net>2024-08-16 11:19:07 +0200
commitaf75221839a919ed1bad4fce88f849cc342641ff (patch)
tree2af1507d6150ba89fa2ebe7d1029d227cba89764 /test
parent2aa120d8944ddc4575da6d73b9e36766849c1ba0 (diff)
downloadmullvadvpn-af75221839a919ed1bad4fce88f849cc342641ff.tar.xz
mullvadvpn-af75221839a919ed1bad4fce88f849cc342641ff.zip
Remove `always_run` test macro parameter
Diffstat (limited to 'test')
-rw-r--r--test/test-manager/src/run_tests.rs3
-rw-r--r--test/test-manager/src/tests/test_metadata.rs1
-rw-r--r--test/test-manager/test_macro/src/lib.rs23
3 files changed, 3 insertions, 24 deletions
diff --git a/test/test-manager/src/run_tests.rs b/test/test-manager/src/run_tests.rs
index 14522d8a84..3222a98475 100644
--- a/test/test-manager/src/run_tests.rs
+++ b/test/test-manager/src/run_tests.rs
@@ -147,9 +147,6 @@ pub async fn run(
if !test_filters.is_empty() {
tests.retain(|test| {
- if test.always_run {
- return true;
- }
for command in test_filters {
let command = command.to_lowercase();
if test.command.to_lowercase().contains(&command) {
diff --git a/test/test-manager/src/tests/test_metadata.rs b/test/test-manager/src/tests/test_metadata.rs
index d3d7a40407..70476ac199 100644
--- a/test/test-manager/src/tests/test_metadata.rs
+++ b/test/test-manager/src/tests/test_metadata.rs
@@ -8,7 +8,6 @@ pub struct TestMetadata {
pub mullvad_client_version: MullvadClientVersion,
pub func: TestWrapperFunction,
pub priority: Option<i32>,
- pub always_run: bool,
}
impl TestMetadata {
diff --git a/test/test-manager/test_macro/src/lib.rs b/test/test-manager/test_macro/src/lib.rs
index 5a14a51c6b..1b80776f29 100644
--- a/test/test-manager/test_macro/src/lib.rs
+++ b/test/test-manager/test_macro/src/lib.rs
@@ -23,9 +23,6 @@ use test_rpc::meta::Os;
/// * `priority` - The order in which tests will be run where low numbers run before high numbers
/// and tests with the same number run in undefined order. `priority` defaults to 0.
///
-/// * `always_run` - If the test should always run regardless of what test filters are provided by
-/// the user. `always_run` defaults to false.
-///
/// * `target_os` - The test should only run on the specified OS. This can currently be set to
/// `linux`, `windows`, or `macos`.
///
@@ -48,10 +45,10 @@ use test_rpc::meta::Os;
///
/// ## Create a test with custom parameters
///
-/// This test will run early in the test loop and will always run.
+/// This test will run early in the test loop.
///
/// ```ignore
-/// #[test_function(priority = -1337, always_run = true)]
+/// #[test_function(priority = -1337)]
/// pub async fn test_function(
/// rpc: ServiceClient,
/// mut mullvad_client: mullvad_management_interface::MullvadProxyClient,
@@ -105,7 +102,6 @@ fn parse_marked_test_function(
fn get_test_macro_parameters(attributes: &syn::AttributeArgs) -> Result<MacroParameters> {
let mut priority = None;
- let mut always_run = false;
let mut targets = vec![];
for attribute in attributes {
@@ -120,11 +116,6 @@ fn get_test_macro_parameters(attributes: &syn::AttributeArgs) -> Result<MacroPar
Lit::Int(lit_int) => priority = Some(lit_int.base10_parse().unwrap()),
_ => bail!(nv, "'priority' should have an integer value"),
}
- } else if nv.path.is_ident("always_run") {
- match lit {
- Lit::Bool(lit_bool) => always_run = lit_bool.value(),
- _ => bail!(nv, "'always_run' should have a bool value"),
- }
} else if nv.path.is_ident("target_os") {
let Lit::Str(lit_str) = lit else {
bail!(nv, "'target_os' should have a string value");
@@ -145,11 +136,7 @@ fn get_test_macro_parameters(attributes: &syn::AttributeArgs) -> Result<MacroPar
}
}
- Ok(MacroParameters {
- priority,
- always_run,
- targets,
- })
+ Ok(MacroParameters { priority, targets })
}
fn create_test(test_function: TestFunction) -> proc_macro2::TokenStream {
@@ -165,8 +152,6 @@ fn create_test(test_function: TestFunction) -> proc_macro2::TokenStream {
})
.collect();
- let always_run = test_function.macro_parameters.always_run;
-
let func_name = test_function.name;
let function_mullvad_version = test_function.function_parameters.mullvad_client.version();
let wrapper_closure = match test_function.function_parameters.mullvad_client {
@@ -207,7 +192,6 @@ fn create_test(test_function: TestFunction) -> proc_macro2::TokenStream {
mullvad_client_version: #function_mullvad_version,
func: #wrapper_closure,
priority: #test_function_priority,
- always_run: #always_run,
});
}
}
@@ -220,7 +204,6 @@ struct TestFunction {
struct MacroParameters {
priority: Option<i32>,
- always_run: bool,
targets: Vec<Os>,
}