Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Restrict syntax for setting ink! e2e test node to auto #2146

Merged
merged 3 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
26 changes: 15 additions & 11 deletions crates/e2e/macro/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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)),
};
Expand All @@ -164,23 +165,14 @@ mod tests {
}

#[test]
fn config_works_backend_node_default_auto() {
fn config_works_backend_node() {
let input = quote! {
backend(node),
};
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_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) => {
Expand All @@ -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! {
Expand Down