Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Use existing node to run e2e tests in dev #2047

Merged
merged 4 commits into from
Jan 8, 2024
Merged
Changes from all 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
17 changes: 11 additions & 6 deletions crates/e2e/macro/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
}

Expand Down Expand Up @@ -77,10 +76,13 @@ 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 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<String> {
self.node_url.clone()
std::env::var("CONTRACTS_NODE_URL")
.ok()
.or_else(|| self.node_url.clone())
}
}

Expand Down Expand Up @@ -114,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]
Expand Down