From 6d7810ee355fcfc2e180822b3e532251dd9bc9c0 Mon Sep 17 00:00:00 2001 From: Bohdan Ohorodnii <35969035+varex83@users.noreply.github.com> Date: Wed, 19 Jul 2023 19:12:09 +0300 Subject: [PATCH] ink-e2e Test Failures in substrate-contracts-node (v0.27.0) due to Unsupported --ws-port Argument (#1850) * Update ink-e2e to the latest substrate-contracts-node * Apply rust-fmt * Change logging, to be up-to-date with master branch * Apply rustfmt-nightly --- crates/e2e/src/node_proc.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/crates/e2e/src/node_proc.rs b/crates/e2e/src/node_proc.rs index 450d89b2618..2ee353fb640 100644 --- a/crates/e2e/src/node_proc.rs +++ b/crates/e2e/src/node_proc.rs @@ -134,21 +134,21 @@ where // Wait for RPC port to be logged (it's logged to stderr): let stderr = proc.stderr.take().unwrap(); - let ws_port = find_substrate_port_from_output(stderr); - let ws_url = format!("ws://127.0.0.1:{ws_port}"); + let port = find_substrate_port_from_output(stderr); + let url = format!("ws://127.0.0.1:{port}"); // Connect to the node with a `subxt` client: - let client = OnlineClient::from_url(ws_url.clone()).await; + let client = OnlineClient::from_url(url.clone()).await; match client { Ok(client) => { Ok(TestNodeProcess { proc, client, - url: ws_url.clone(), + url: url.clone(), }) } Err(err) => { - let err = format!("Failed to connect to node rpc at {ws_url}: {err}"); + let err = format!("Failed to connect to node rpc at {url}: {err}"); tracing::error!("{}", err); proc.kill().map_err(|e| { format!("Error killing substrate process '{}': {}", proc.id(), e) @@ -172,6 +172,9 @@ fn find_substrate_port_from_output(r: impl Read + Send + 'static) -> u16 { // substrate). let line_end = line .rsplit_once("Listening for new connections on 127.0.0.1:") + .or_else(|| { + line.rsplit_once("Running JSON-RPC WS server: addr=127.0.0.1:") + }) .or_else(|| line.rsplit_once("Running JSON-RPC server: addr=127.0.0.1:")) .map(|(_, port_str)| port_str)?; @@ -181,7 +184,7 @@ fn find_substrate_port_from_output(r: impl Read + Send + 'static) -> u16 { // expect to have a number here (the chars after '127.0.0.1:') and parse them // into a u16. let port_num = port_str.parse().unwrap_or_else(|_| { - panic!("valid port expected for log line, got '{port_str}'") + panic!("valid port expected for tracing line, got '{port_str}'") }); Some(port_num)