paritytech / substrate

Substrate: The platform for blockchain innovators
Apache License 2.0
8.39k stars 2.65k forks source link

test-utils: programatically spawn dev nodes #14704

Closed liamaharon closed 1 year ago

liamaharon commented 1 year ago

I am in the process of migrating try-runtime-cli into an independent repo (https://github.com/paritytech/try-runtime-cli/pull/6).

Multiple try-runtime-cli tests use substrate_cli_test_utils::start_node to spawn a node to run commands against.

Unfortunately, substrate_cli_test_utils::start_node depends on the substrate-node binary being accessible by cargo_bin (calls cargo_bin("substrate-node")), which is not the case outside of substrate.

In this PR I create a new method substrate_cli_test_utils::start_node_inline.

The new method functions similarly to start_node, but can be run in environments without the ability to access a node binary with cargo_bin("substrate-node").

Honestly I am not sure if this is the best approach to solving this problem, I'm open to other suggestions if there're better ones.

liamaharon commented 1 year ago

bot merge force