Skip to content

Commit

Permalink
fix: substrate-runner support several rpc endpoints (#1736)
Browse files Browse the repository at this point in the history
* fix: support several rpc endpoints in substrate

Close #1735

* Update testing/substrate-runner/src/lib.rs

* Update testing/substrate-runner/src/lib.rs

* fix grumbles

* Update testing/substrate-runner/src/lib.rs
  • Loading branch information
niklasad1 committed Aug 29, 2024
1 parent 374193a commit 6e01451
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions testing/substrate-runner/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,10 @@ fn try_find_substrate_port_from_output(
.or_else(|| line.rsplit_once("Running JSON-RPC server: addr=127.0.0.1:"))
.map(|(_, port_str)| port_str);

if let Some(line_port) = line_port {
// trim non-numeric chars from the end of the port part of the line.
let port_str = line_port.trim_end_matches(|b: char| !b.is_ascii_digit());
if let Some(ports) = line_port {
// If more than one rpc server is started the log will capture multiple ports
// such as `addr=127.0.0.1:9944,[::1]:9944`
let port_str: String = ports.chars().take_while(|c| c.is_numeric()).collect();

// expect to have a number here (the chars after '127.0.0.1:') and parse them into a u16.
let port_num = port_str
Expand Down

0 comments on commit 6e01451

Please sign in to comment.