From a59e025098b9ef3e5f1ca29cede58ff9bc50f171 Mon Sep 17 00:00:00 2001 From: davidsemakula Date: Fri, 8 Mar 2024 16:44:01 +0300 Subject: [PATCH 1/2] Restrict syntax for setting ink! e2e test node to auto --- crates/e2e/macro/src/config.rs | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/crates/e2e/macro/src/config.rs b/crates/e2e/macro/src/config.rs index b5d561c3480..182549edeef 100644 --- a/crates/e2e/macro/src/config.rs +++ b/crates/e2e/macro/src/config.rs @@ -40,6 +40,7 @@ impl Default for Backend { pub enum Node { /// A fresh node instance will be spawned for the lifetime of the test. #[darling(word)] + #[darling(skip)] Auto, /// The test will run against an already running node at the supplied URL. Url(String), @@ -137,7 +138,7 @@ mod tests { #[test] #[should_panic(expected = "ErrorUnknownField")] - fn config_works_backend_runtime_only_default_not_allowed() { + fn config_backend_runtime_only_default_not_allowed() { let input = quote! { backend(runtime_only(default)), }; @@ -164,7 +165,7 @@ mod tests { } #[test] - fn config_works_backend_node_default_auto() { + fn config_works_backend_node() { let input = quote! { backend(node), }; @@ -172,15 +173,6 @@ mod tests { E2EConfig::from_list(&NestedMeta::parse_meta_list(input).unwrap()).unwrap(); assert_eq!(config.backend(), Backend::Node(Node::Auto)); - } - - #[test] - fn config_works_backend_node_auto() { - let input = quote! { - backend(node(auto)), - }; - let config = - E2EConfig::from_list(&NestedMeta::parse_meta_list(input).unwrap()).unwrap(); match config.backend() { Backend::Node(node_config) => { @@ -204,6 +196,18 @@ mod tests { } } + #[test] + #[should_panic(expected = "ErrorUnknownField")] + fn config_backend_node_auto_not_allowed() { + let input = quote! { + backend(node(auto)), + }; + let config = + E2EConfig::from_list(&NestedMeta::parse_meta_list(input).unwrap()).unwrap(); + + assert_eq!(config.backend(), Backend::Node(Node::Auto)); + } + #[test] fn config_works_backend_node_url() { let input = quote! { From 63ffa595c3b5ffa80c9b76a871291efafaf64f8a Mon Sep 17 00:00:00 2001 From: davidsemakula Date: Fri, 8 Mar 2024 17:24:02 +0300 Subject: [PATCH 2/2] Add changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 69f847e66e4..98fdc490bd3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Use name-only syntax for `anonymous` ink! event item configuration argument - [#2140](https://github.com/paritytech/ink/pull/2140) - Restrict syntax for setting default ink! e2e test runtime-only emulator - [#2143](https://github.com/paritytech/ink/pull/2143) +- Restrict syntax for setting ink! e2e test node to auto - [#2146](https://github.com/paritytech/ink/pull/2146) ## Version 5.0.0-rc.2