diff options
| author | Sebastian Holmin <sebastian.holmin@mullvad.net> | 2024-08-14 03:13:50 +0200 |
|---|---|---|
| committer | Sebastian Holmin <sebastian.holmin@mullvad.net> | 2024-08-16 11:19:07 +0200 |
| commit | afc15082c8d4e1c4e1fe392eb75d2f62e0486359 (patch) | |
| tree | 17560cb035e6aa33dc9e50759824dea300469c37 /test/test-manager/src/main.rs | |
| parent | af75221839a919ed1bad4fce88f849cc342641ff (diff) | |
| download | mullvadvpn-afc15082c8d4e1c4e1fe392eb75d2f62e0486359.tar.xz mullvadvpn-afc15082c8d4e1c4e1fe392eb75d2f62e0486359.zip | |
Run tests in the order given
Diffstat (limited to 'test/test-manager/src/main.rs')
| -rw-r--r-- | test/test-manager/src/main.rs | 58 |
1 files changed, 28 insertions, 30 deletions
diff --git a/test/test-manager/src/main.rs b/test/test-manager/src/main.rs index 9c05289936..88203cd8c2 100644 --- a/test/test-manager/src/main.rs +++ b/test/test-manager/src/main.rs @@ -13,6 +13,7 @@ use std::{net::SocketAddr, path::PathBuf}; use anyhow::{Context, Result}; use clap::Parser; +use tests::{config::TEST_CONFIG, get_filtered_tests}; use vm::provision; use crate::tests::config::OpenVPNCertificate; @@ -118,7 +119,8 @@ enum Commands { #[arg(long)] openvpn_certificate: Option<PathBuf>, - /// Only run tests matching substrings + /// Names of tests to run. The order given will be respected. If not set, all tests will be + /// run. test_filters: Vec<String>, /// Print results live @@ -294,6 +296,28 @@ async fn main() -> Result<()> { .await .context("Failed to run provisioning for VM")?; + TEST_CONFIG.init(tests::config::TestConfig::new( + account, + artifacts_dir, + manifest + .app_package_path + .file_name() + .unwrap() + .to_string_lossy() + .into_owned(), + manifest + .app_package_to_upgrade_from_path + .map(|path| path.file_name().unwrap().to_string_lossy().into_owned()), + manifest + .gui_package_path + .map(|path| path.file_name().unwrap().to_string_lossy().into_owned()), + mullvad_host, + vm::network::bridge()?, + test_rpc::meta::Os::from(vm_config.os_type), + openvpn_certificate, + )); + let tests = get_filtered_tests(&test_filters)?; + // For convenience, spawn a SOCKS5 server that is reachable for tests that need it let socks = socks_server::spawn(SocketAddr::new( crate::vm::network::NON_TUN_GATEWAY.into(), @@ -303,35 +327,9 @@ async fn main() -> Result<()> { let skip_wait = vm_config.provisioner != config::Provisioner::Noop; - let result = run_tests::run( - tests::config::TestConfig::new( - account, - artifacts_dir, - manifest - .app_package_path - .file_name() - .unwrap() - .to_string_lossy() - .into_owned(), - manifest - .app_package_to_upgrade_from_path - .map(|path| path.file_name().unwrap().to_string_lossy().into_owned()), - manifest - .gui_package_path - .map(|path| path.file_name().unwrap().to_string_lossy().into_owned()), - mullvad_host, - vm::network::bridge()?, - test_rpc::meta::Os::from(vm_config.os_type), - openvpn_certificate, - ), - &*instance, - &test_filters, - skip_wait, - !verbose, - summary_logger, - ) - .await - .context("Tests failed"); + let result = run_tests::run(&*instance, tests, skip_wait, !verbose, summary_logger) + .await + .context("Tests failed"); if display { instance.wait().await; |
