Skip to content

Commit 286cf43

Browse files
authored
Merge pull request #2615 from fermyon/conformance-test-updates
2 parents fe52a61 + bd6aaa6 commit 286cf43

File tree

5 files changed

+32
-25
lines changed

5 files changed

+32
-25
lines changed

Cargo.lock

Lines changed: 5 additions & 5 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: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ fn run_test(test: conformance_tests::Test, spin_binary: &std::path::Path) -> any
1414
for precondition in test.config.preconditions {
1515
match precondition {
1616
conformance_tests::config::Precondition::HttpEcho => {
17-
services.push("http-echo".into());
17+
services.push("http-echo");
1818
}
1919
conformance_tests::config::Precondition::TcpEcho => {
20-
services.push("tcp-echo".into());
20+
services.push("tcp-echo");
2121
}
22-
conformance_tests::config::Precondition::Redis => services.push("redis".into()),
22+
conformance_tests::config::Precondition::Redis => services.push("redis"),
23+
conformance_tests::config::Precondition::Mqtt => services.push("mqtt"),
2324
conformance_tests::config::Precondition::KeyValueStore(_) => {}
2425
conformance_tests::config::Precondition::Sqlite => {}
2526
}

tests/integration.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ mod integration_tests {
109109
spin_up_args: Vec::new(),
110110
app_type: SpinAppType::Redis,
111111
},
112-
ServicesConfig::new(vec!["redis".into()])?,
112+
ServicesConfig::new(vec!["redis"])?,
113113
move |env| {
114114
let redis_port = env
115115
.services_mut()
@@ -167,7 +167,7 @@ mod integration_tests {
167167
spin_up_args: Vec::new(),
168168
app_type: SpinAppType::Http,
169169
},
170-
ServicesConfig::new(vec!["jaeger".into()])?,
170+
ServicesConfig::new(vec!["jaeger"])?,
171171
|env| {
172172
let otel_port = env
173173
.services_mut()
@@ -480,7 +480,7 @@ Caused by:
480480
spin_up_args: vec!["--runtime-config-file".into(), "runtime_config.toml".into()],
481481
app_type: SpinAppType::Http,
482482
},
483-
ServicesConfig::new(vec!["vault".into()])?,
483+
ServicesConfig::new(vec!["vault"])?,
484484
|env| {
485485
// Vault can take a few moments to be ready
486486
std::thread::sleep(std::time::Duration::from_secs(2));
@@ -730,7 +730,7 @@ Caused by:
730730
#[test]
731731
#[cfg(feature = "extern-dependencies-tests")]
732732
fn registry_works() -> anyhow::Result<()> {
733-
let services = ServicesConfig::new(vec!["registry".into()])?;
733+
let services = ServicesConfig::new(vec!["registry"])?;
734734
let spin_up_args = |env: &mut test_environment::TestEnvironment<()>| {
735735
let registry_url = format!(
736736
"localhost:{}/spin-e2e-tests/registry-works/v1",
@@ -747,7 +747,7 @@ Caused by:
747747
])
748748
};
749749
let mut env = super::testcases::bootstrap_smoke_test(
750-
&services,
750+
services,
751751
None,
752752
None,
753753
&[],
@@ -786,7 +786,7 @@ Caused by:
786786
spin_up_args: Vec::new(),
787787
app_type: SpinAppType::Http,
788788
},
789-
ServicesConfig::new(vec!["http-echo".into()])?,
789+
ServicesConfig::new(vec!["http-echo"])?,
790790
move |env| {
791791
let port = env
792792
.get_port(80)?
@@ -810,7 +810,7 @@ Caused by:
810810

811811
#[test]
812812
fn spin_up_gives_help_on_new_app() -> anyhow::Result<()> {
813-
let mut env = test_environment::TestEnvironment::<()>::boot(&ServicesConfig::none())?;
813+
let mut env = test_environment::TestEnvironment::<()>::boot(ServicesConfig::none())?;
814814

815815
// We still don't see full help if there are no components.
816816
let toml_text = r#"spin_version = "1"
@@ -848,7 +848,7 @@ route = "/..."
848848

849849
#[test]
850850
fn spin_up_help_build_does_not_build() -> anyhow::Result<()> {
851-
let mut env = test_environment::TestEnvironment::<()>::boot(&ServicesConfig::none())?;
851+
let mut env = test_environment::TestEnvironment::<()>::boot(ServicesConfig::none())?;
852852

853853
// We still don't see full help if there are no components.
854854
let toml_text = r#"spin_version = "1"
@@ -891,7 +891,7 @@ route = "/..."
891891
#[cfg(not(target_os = "windows"))]
892892
#[test]
893893
fn test_spin_plugin_install_command() -> anyhow::Result<()> {
894-
let env = test_environment::TestEnvironment::<()>::boot(&ServicesConfig::none())?;
894+
let env = test_environment::TestEnvironment::<()>::boot(ServicesConfig::none())?;
895895

896896
let path_to_test_dir = std::env::current_dir()?;
897897
let file_url = format!(
@@ -1011,7 +1011,7 @@ route = "/..."
10111011
#[cfg(not(target_os = "windows"))]
10121012
#[test]
10131013
fn test_cloud_plugin_autoinstall() -> anyhow::Result<()> {
1014-
let env = test_environment::TestEnvironment::<()>::boot(&ServicesConfig::none())?;
1014+
let env = test_environment::TestEnvironment::<()>::boot(ServicesConfig::none())?;
10151015

10161016
let mut login = std::process::Command::new(spin_binary());
10171017
login
@@ -1065,7 +1065,7 @@ route = "/..."
10651065
})
10661066
.collect::<std::collections::HashMap<_, _>>();
10671067

1068-
let env = test_environment::TestEnvironment::<()>::boot(&ServicesConfig::none())?;
1068+
let env = test_environment::TestEnvironment::<()>::boot(ServicesConfig::none())?;
10691069
env.copy_into(dir, ".")?;
10701070

10711071
let mut build = std::process::Command::new(spin_binary());
@@ -1178,7 +1178,7 @@ route = "/..."
11781178
spin_up_args: Vec::new(),
11791179
app_type: SpinAppType::Http,
11801180
},
1181-
ServicesConfig::new(vec!["http-responses-from-file".into()])?,
1181+
ServicesConfig::new(vec!["http-responses-from-file"])?,
11821182
move |env| {
11831183
let service_url = format!(
11841184
"http://localhost:{}",
@@ -1366,7 +1366,7 @@ route = "/..."
13661366
spin_up_args: Vec::new(),
13671367
app_type: SpinAppType::Http,
13681368
},
1369-
ServicesConfig::new(vec!["http-echo".into()])?,
1369+
ServicesConfig::new(vec!["http-echo"])?,
13701370
move |env| {
13711371
let service_url = format!(
13721372
"http://localhost:{}",

tests/runtime-tests/src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,12 @@ impl<R> RuntimeTest<R> {
271271

272272
fn services_config<R>(config: &RuntimeTestConfig<R>) -> anyhow::Result<ServicesConfig> {
273273
let required_services = required_services(&config.test_path)?;
274-
let services_config = ServicesConfig::new(required_services)?;
274+
let services_config = ServicesConfig::new(
275+
required_services
276+
.iter()
277+
.map(String::as_str)
278+
.collect::<Vec<_>>(),
279+
)?;
275280
Ok(services_config)
276281
}
277282

tests/testcases/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ pub fn http_smoke_test_template_with_route(
181181
expected_body: &str,
182182
) -> anyhow::Result<()> {
183183
let mut env = bootstrap_smoke_test(
184-
&ServicesConfig::none(),
184+
ServicesConfig::none(),
185185
template_url,
186186
template_branch,
187187
plugins,
@@ -214,7 +214,7 @@ pub fn redis_smoke_test_template(
214214
) -> anyhow::Result<()> {
215215
use redis::Commands;
216216
let mut env = bootstrap_smoke_test(
217-
&test_environment::services::ServicesConfig::new(vec!["redis".into()])?,
217+
test_environment::services::ServicesConfig::new(vec!["redis"])?,
218218
template_url,
219219
template_branch,
220220
plugins,
@@ -257,7 +257,7 @@ static TEMPLATE_MUTEX: std::sync::Mutex<()> = std::sync::Mutex::new(());
257257
// TODO: refactor this function to not take so many arguments
258258
#[allow(clippy::too_many_arguments)]
259259
pub fn bootstrap_smoke_test(
260-
services: &ServicesConfig,
260+
services: ServicesConfig,
261261
template_url: Option<&str>,
262262
template_branch: Option<&str>,
263263
plugins: &[&str],
@@ -310,6 +310,7 @@ pub fn bootstrap_smoke_test(
310310
"-o",
311311
".",
312312
"--accept-defaults",
313+
"--allow-overwrite",
313314
])
314315
.args(new_app_args(&mut env)?);
315316
env.run_in(&mut new_app)?;

0 commit comments

Comments
 (0)