From 10019165166948f887ec7664d54fb21de4260148 Mon Sep 17 00:00:00 2001 From: pgherveou Date: Mon, 8 Jan 2024 11:33:18 +0100 Subject: [PATCH 1/4] Update --- crates/e2e/macro/src/config.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/crates/e2e/macro/src/config.rs b/crates/e2e/macro/src/config.rs index 481c8e468e..d7058e0b1d 100644 --- a/crates/e2e/macro/src/config.rs +++ b/crates/e2e/macro/src/config.rs @@ -46,8 +46,7 @@ pub struct E2EConfig { /// The type of the architecture that should be used to run test. #[darling(default)] backend: Backend, - /// The URL to the running node. If not set then a default node instance will be - /// spawned per test. + /// The URL to the running node. See [`Self::node_url()`] for more details. node_url: Option, } @@ -77,10 +76,12 @@ impl E2EConfig { self.backend.clone() } - /// The URL to the running node. If not set then a default node instance will be - /// spawned per test. + /// The URL to the running node, default to `CONTRACTS_NODE_URL` env is not set. + /// If no URL is provided, then a default node instance will be spawned per test. pub fn node_url(&self) -> Option { - self.node_url.clone() + self.node_url + .clone() + .or_else(|| std::env::var("CONTRACTS_NODE_URL").ok()) } } From 7a35d481e06dc4258cd92ef8ad7987854b1c61f1 Mon Sep 17 00:00:00 2001 From: PG Herveou Date: Mon, 8 Jan 2024 11:37:47 +0100 Subject: [PATCH 2/4] Update crates/e2e/macro/src/config.rs --- crates/e2e/macro/src/config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/e2e/macro/src/config.rs b/crates/e2e/macro/src/config.rs index d7058e0b1d..262ddca5c4 100644 --- a/crates/e2e/macro/src/config.rs +++ b/crates/e2e/macro/src/config.rs @@ -76,7 +76,7 @@ impl E2EConfig { self.backend.clone() } - /// The URL to the running node, default to `CONTRACTS_NODE_URL` env is not set. + /// The URL to the running node, default to `CONTRACTS_NODE_URL` if not set. /// If no URL is provided, then a default node instance will be spawned per test. pub fn node_url(&self) -> Option { self.node_url From e9e73907d992d107a7224b2b6626443b2b5301bf Mon Sep 17 00:00:00 2001 From: pgherveou Date: Mon, 8 Jan 2024 12:12:39 +0100 Subject: [PATCH 3/4] fix and add test --- crates/e2e/macro/src/config.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/crates/e2e/macro/src/config.rs b/crates/e2e/macro/src/config.rs index 262ddca5c4..8e375f5505 100644 --- a/crates/e2e/macro/src/config.rs +++ b/crates/e2e/macro/src/config.rs @@ -76,12 +76,13 @@ impl E2EConfig { self.backend.clone() } - /// The URL to the running node, default to `CONTRACTS_NODE_URL` if not set. - /// If no URL is provided, then a default node instance will be spawned per test. + /// The URL to the running node, default value can be overriden with + /// `CONTRACTS_NODE_URL`. If no URL is provided, then a default node instance will + /// be spawned per test. pub fn node_url(&self) -> Option { - self.node_url - .clone() - .or_else(|| std::env::var("CONTRACTS_NODE_URL").ok()) + std::env::var("CONTRACTS_NODE_URL") + .ok() + .or_else(|| self.node_url.clone()) } } @@ -115,7 +116,10 @@ mod tests { ); assert_eq!(config.backend(), Backend::RuntimeOnly { runtime: None }); - assert_eq!(config.node_url(), Some(String::from("ws://127.0.0.1:8000"))) + assert_eq!(config.node_url(), Some(String::from("ws://127.0.0.1:8000"))); + + std::env::set_var("CONTRACTS_NODE_URL", "ws://127.0.0.1:9000"); + assert_eq!(config.node_url(), Some(String::from("ws://127.0.0.1:9000"))) } #[test] From 0364d322aed5d353a6f113b1f7352b3ad23648c9 Mon Sep 17 00:00:00 2001 From: PG Herveou Date: Mon, 8 Jan 2024 13:12:09 +0100 Subject: [PATCH 4/4] Update crates/e2e/macro/src/config.rs --- crates/e2e/macro/src/config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/e2e/macro/src/config.rs b/crates/e2e/macro/src/config.rs index 8e375f5505..a9d48d026d 100644 --- a/crates/e2e/macro/src/config.rs +++ b/crates/e2e/macro/src/config.rs @@ -76,7 +76,7 @@ impl E2EConfig { self.backend.clone() } - /// The URL to the running node, default value can be overriden with + /// The URL to the running node, default value can be overridden with /// `CONTRACTS_NODE_URL`. If no URL is provided, then a default node instance will /// be spawned per test. pub fn node_url(&self) -> Option {