Skip to content

Commit 5b4879d

Browse files
authored
Merge pull request #2562 from fermyon/update-conformance-tests
Update conformance test
2 parents aedc2b8 + aa13a58 commit 5b4879d

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/conformance-tests/src/main.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,37 @@ fn main() {
88
let tests_dir = conformance_tests::download_tests().unwrap();
99

1010
for test in conformance_tests::tests(&tests_dir).unwrap() {
11+
println!("Running test '{}'", test.name);
1112
let env_config = SpinCli::config(
1213
SpinConfig {
1314
binary_path: spin_binary.clone(),
1415
spin_up_args: Vec::new(),
1516
app_type: testing_framework::runtimes::SpinAppType::Http,
1617
},
17-
test_environment::services::ServicesConfig::none(),
18+
test_environment::services::ServicesConfig::new(test.config.services).unwrap(),
1819
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())?;
2025
e.copy_into(&test.component, test.component.file_name().unwrap())?;
2126
Ok(())
2227
},
2328
);
2429
let mut env = test_environment::TestEnvironment::up(env_config, |_| Ok(())).unwrap();
25-
let spin = env.runtime_mut();
2630
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();
2834
let actual = invocation
2935
.request
3036
.send(|request| spin.make_http_request(request))
3137
.unwrap();
3238
if let Err(e) =
3339
conformance_tests::assertions::assert_response(&invocation.response, &actual)
3440
{
35-
eprintln!("Test failed: {e}");
41+
eprintln!("Test '{}' failed: {e}", test.name);
3642
eprintln!("stderr: {}", spin.stderr());
3743
std::process::exit(1);
3844
}

0 commit comments

Comments
 (0)