@@ -8,31 +8,37 @@ fn main() {
8
8
let tests_dir = conformance_tests:: download_tests ( ) . unwrap ( ) ;
9
9
10
10
for test in conformance_tests:: tests ( & tests_dir) . unwrap ( ) {
11
+ println ! ( "Running test '{}'" , test. name) ;
11
12
let env_config = SpinCli :: config (
12
13
SpinConfig {
13
14
binary_path : spin_binary. clone ( ) ,
14
15
spin_up_args : Vec :: new ( ) ,
15
16
app_type : testing_framework:: runtimes:: SpinAppType :: Http ,
16
17
} ,
17
- test_environment:: services:: ServicesConfig :: none ( ) ,
18
+ test_environment:: services:: ServicesConfig :: new ( test . config . services ) . unwrap ( ) ,
18
19
move |e| {
19
- e. copy_into ( & test. manifest , "spin.toml" ) ?;
20
+ let mut manifest =
21
+ test_environment:: manifest_template:: EnvTemplate :: from_file ( & test. manifest )
22
+ . unwrap ( ) ;
23
+ manifest. substitute ( e, |_| None ) . unwrap ( ) ;
24
+ e. write_file ( "spin.toml" , manifest. contents ( ) ) ?;
20
25
e. copy_into ( & test. component , test. component . file_name ( ) . unwrap ( ) ) ?;
21
26
Ok ( ( ) )
22
27
} ,
23
28
) ;
24
29
let mut env = test_environment:: TestEnvironment :: up ( env_config, |_| Ok ( ( ) ) ) . unwrap ( ) ;
25
- let spin = env. runtime_mut ( ) ;
26
30
for invocation in test. config . invocations {
27
- let conformance_tests:: config:: Invocation :: Http ( invocation) = invocation;
31
+ let conformance_tests:: config:: Invocation :: Http ( mut invocation) = invocation;
32
+ invocation. request . substitute_from_env ( & mut env) . unwrap ( ) ;
33
+ let spin = env. runtime_mut ( ) ;
28
34
let actual = invocation
29
35
. request
30
36
. send ( |request| spin. make_http_request ( request) )
31
37
. unwrap ( ) ;
32
38
if let Err ( e) =
33
39
conformance_tests:: assertions:: assert_response ( & invocation. response , & actual)
34
40
{
35
- eprintln ! ( "Test failed: {e}" ) ;
41
+ eprintln ! ( "Test '{}' failed: {e}" , test . name ) ;
36
42
eprintln ! ( "stderr: {}" , spin. stderr( ) ) ;
37
43
std:: process:: exit ( 1 ) ;
38
44
}
0 commit comments