read RPC port from logs in `regtest_submit_blocks()` test (#8665)

This commit is contained in:
Arya 2024-07-08 19:12:23 -04:00 committed by GitHub
parent 09935bb433
commit 2419e8a342
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 5 deletions

View File

@ -14,13 +14,16 @@ use zebra_chain::{
serialization::ZcashSerialize, serialization::ZcashSerialize,
}; };
use zebra_node_services::rpc_client::RpcRequestClient; use zebra_node_services::rpc_client::RpcRequestClient;
use zebra_rpc::methods::get_block_template_rpcs::get_block_template::{ use zebra_rpc::{
proposal::TimeSource, proposal_block_from_template, GetBlockTemplate, methods::get_block_template_rpcs::get_block_template::{
proposal::TimeSource, proposal_block_from_template, GetBlockTemplate,
},
server::OPENED_RPC_ENDPOINT_MSG,
}; };
use zebra_test::args; use zebra_test::args;
use crate::common::{ use crate::common::{
config::{random_known_rpc_port_config, testdir}, config::{os_assigned_rpc_port_config, read_listen_addr_from_logs, testdir},
launch::ZebradTestDirExt, launch::ZebradTestDirExt,
}; };
@ -32,14 +35,15 @@ pub(crate) async fn submit_blocks_test() -> Result<()> {
info!("starting regtest submit_blocks test"); info!("starting regtest submit_blocks test");
let network = Network::new_regtest(None); let network = Network::new_regtest(None);
let mut config = random_known_rpc_port_config(false, &network)?; let mut config = os_assigned_rpc_port_config(false, &network)?;
config.mempool.debug_enable_at_height = Some(0); config.mempool.debug_enable_at_height = Some(0);
let rpc_address = config.rpc.listen_addr.unwrap();
let mut zebrad = testdir()? let mut zebrad = testdir()?
.with_config(&mut config)? .with_config(&mut config)?
.spawn_child(args!["start"])?; .spawn_child(args!["start"])?;
let rpc_address = read_listen_addr_from_logs(&mut zebrad, OPENED_RPC_ENDPOINT_MSG)?;
info!("waiting for zebrad to start"); info!("waiting for zebrad to start");
tokio::time::sleep(Duration::from_secs(30)).await; tokio::time::sleep(Duration::from_secs(30)).await;