@@ -13,6 +13,7 @@ use std::{net::SocketAddr, path::PathBuf};
13
13
14
14
use anyhow:: { Context , Result } ;
15
15
use clap:: Parser ;
16
+ use tests:: { config:: TEST_CONFIG , get_filtered_tests} ;
16
17
use vm:: provision;
17
18
18
19
use crate :: tests:: config:: OpenVPNCertificate ;
@@ -118,7 +119,8 @@ enum Commands {
118
119
#[ arg( long) ]
119
120
openvpn_certificate : Option < PathBuf > ,
120
121
121
- /// Only run tests matching substrings
122
+ /// Names of tests to run. The order given will be respected. If not set, all tests will be
123
+ /// run.
122
124
test_filters : Vec < String > ,
123
125
124
126
/// Print results live
@@ -294,6 +296,28 @@ async fn main() -> Result<()> {
294
296
. await
295
297
. context ( "Failed to run provisioning for VM" ) ?;
296
298
299
+ TEST_CONFIG . init ( tests:: config:: TestConfig :: new (
300
+ account,
301
+ artifacts_dir,
302
+ manifest
303
+ . app_package_path
304
+ . file_name ( )
305
+ . unwrap ( )
306
+ . to_string_lossy ( )
307
+ . into_owned ( ) ,
308
+ manifest
309
+ . app_package_to_upgrade_from_path
310
+ . map ( |path| path. file_name ( ) . unwrap ( ) . to_string_lossy ( ) . into_owned ( ) ) ,
311
+ manifest
312
+ . gui_package_path
313
+ . map ( |path| path. file_name ( ) . unwrap ( ) . to_string_lossy ( ) . into_owned ( ) ) ,
314
+ mullvad_host,
315
+ vm:: network:: bridge ( ) ?,
316
+ test_rpc:: meta:: Os :: from ( vm_config. os_type ) ,
317
+ openvpn_certificate,
318
+ ) ) ;
319
+ let tests = get_filtered_tests ( & test_filters) ?;
320
+
297
321
// For convenience, spawn a SOCKS5 server that is reachable for tests that need it
298
322
let socks = socks_server:: spawn ( SocketAddr :: new (
299
323
crate :: vm:: network:: NON_TUN_GATEWAY . into ( ) ,
@@ -303,35 +327,9 @@ async fn main() -> Result<()> {
303
327
304
328
let skip_wait = vm_config. provisioner != config:: Provisioner :: Noop ;
305
329
306
- let result = run_tests:: run (
307
- tests:: config:: TestConfig :: new (
308
- account,
309
- artifacts_dir,
310
- manifest
311
- . app_package_path
312
- . file_name ( )
313
- . unwrap ( )
314
- . to_string_lossy ( )
315
- . into_owned ( ) ,
316
- manifest
317
- . app_package_to_upgrade_from_path
318
- . map ( |path| path. file_name ( ) . unwrap ( ) . to_string_lossy ( ) . into_owned ( ) ) ,
319
- manifest
320
- . gui_package_path
321
- . map ( |path| path. file_name ( ) . unwrap ( ) . to_string_lossy ( ) . into_owned ( ) ) ,
322
- mullvad_host,
323
- vm:: network:: bridge ( ) ?,
324
- test_rpc:: meta:: Os :: from ( vm_config. os_type ) ,
325
- openvpn_certificate,
326
- ) ,
327
- & * instance,
328
- & test_filters,
329
- skip_wait,
330
- !verbose,
331
- summary_logger,
332
- )
333
- . await
334
- . context ( "Tests failed" ) ;
330
+ let result = run_tests:: run ( & * instance, tests, skip_wait, !verbose, summary_logger)
331
+ . await
332
+ . context ( "Tests failed" ) ;
335
333
336
334
if display {
337
335
instance. wait ( ) . await ;
0 commit comments