Skip to content

Commit 6d7810e

Browse files
authored
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
1 parent 0749aa6 commit 6d7810e

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

crates/e2e/src/node_proc.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,21 +134,21 @@ where
134134

135135
// Wait for RPC port to be logged (it's logged to stderr):
136136
let stderr = proc.stderr.take().unwrap();
137-
let ws_port = find_substrate_port_from_output(stderr);
138-
let ws_url = format!("ws://127.0.0.1:{ws_port}");
137+
let port = find_substrate_port_from_output(stderr);
138+
let url = format!("ws://127.0.0.1:{port}");
139139

140140
// Connect to the node with a `subxt` client:
141-
let client = OnlineClient::from_url(ws_url.clone()).await;
141+
let client = OnlineClient::from_url(url.clone()).await;
142142
match client {
143143
Ok(client) => {
144144
Ok(TestNodeProcess {
145145
proc,
146146
client,
147-
url: ws_url.clone(),
147+
url: url.clone(),
148148
})
149149
}
150150
Err(err) => {
151-
let err = format!("Failed to connect to node rpc at {ws_url}: {err}");
151+
let err = format!("Failed to connect to node rpc at {url}: {err}");
152152
tracing::error!("{}", err);
153153
proc.kill().map_err(|e| {
154154
format!("Error killing substrate process '{}': {}", proc.id(), e)
@@ -172,6 +172,9 @@ fn find_substrate_port_from_output(r: impl Read + Send + 'static) -> u16 {
172172
// substrate).
173173
let line_end = line
174174
.rsplit_once("Listening for new connections on 127.0.0.1:")
175+
.or_else(|| {
176+
line.rsplit_once("Running JSON-RPC WS server: addr=127.0.0.1:")
177+
})
175178
.or_else(|| line.rsplit_once("Running JSON-RPC server: addr=127.0.0.1:"))
176179
.map(|(_, port_str)| port_str)?;
177180

@@ -181,7 +184,7 @@ fn find_substrate_port_from_output(r: impl Read + Send + 'static) -> u16 {
181184
// expect to have a number here (the chars after '127.0.0.1:') and parse them
182185
// into a u16.
183186
let port_num = port_str.parse().unwrap_or_else(|_| {
184-
panic!("valid port expected for log line, got '{port_str}'")
187+
panic!("valid port expected for tracing line, got '{port_str}'")
185188
});
186189

187190
Some(port_num)

0 commit comments

Comments
 (0)