Skip to content

Commit 3429977

Browse files
committed
chore: move btc-core-ctrl related tests from neon_integration.rs, #6250
1 parent da1bf1d commit 3429977

File tree

2 files changed

+32
-42
lines changed

2 files changed

+32
-42
lines changed

stacks-node/src/tests/bitcoin_regtest.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ mod tests {
195195
use std::path::Path;
196196

197197
use super::*;
198+
use crate::{BitcoinRegtestController, BurnchainController};
198199
mod utils {
199200
use std::net::TcpListener;
200201

@@ -272,4 +273,35 @@ mod tests {
272273
assert!(!bitcoind.is_running(), "should not be running after kill!");
273274
assert!(data_path.exists(), "data path should exists after kill!");
274275
}
276+
277+
#[test]
278+
#[ignore]
279+
fn test_bitcoind_restart_with_bootstrapped_chain_data() {
280+
if env::var("BITCOIND_TEST") != Ok("1".into()) {
281+
return;
282+
}
283+
284+
let config = utils::create_config();
285+
286+
let mut btcd_controller = BitcoinCoreController::from_stx_config(&config);
287+
btcd_controller
288+
.start_bitcoind()
289+
.expect("Failed starting bitcoind");
290+
291+
let btc_controller = BitcoinRegtestController::new(config, None);
292+
btc_controller.bootstrap_chain(201);
293+
info!("Chain bootstrapped...");
294+
295+
btcd_controller
296+
.stop_bitcoind()
297+
.expect("Failed to stop bitcoind");
298+
299+
btcd_controller
300+
.start_bitcoind()
301+
.expect("Failed to restart bitcoind");
302+
303+
btcd_controller
304+
.stop_bitcoind()
305+
.expect("Failed to re-stop bitcoind");
306+
}
275307
}

stacks-node/src/tests/neon_integrations.rs

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -10024,45 +10024,3 @@ fn listunspent_max_utxos() {
1002410024
let utxos = res.expect("Failed to get utxos");
1002510025
assert_eq!(utxos.num_utxos(), 10);
1002610026
}
10027-
10028-
#[test]
10029-
#[ignore]
10030-
/// Test out stopping bitcoind and restarting it
10031-
fn start_stop_bitcoind() {
10032-
if env::var("BITCOIND_TEST") != Ok("1".into()) {
10033-
return;
10034-
}
10035-
10036-
let (mut conf, _miner_account) = neon_integration_test_conf();
10037-
let prom_port = gen_random_port();
10038-
let localhost = "127.0.0.1";
10039-
let prom_bind = format!("{localhost}:{prom_port}");
10040-
conf.node.prometheus_bind = Some(prom_bind);
10041-
10042-
conf.burnchain.max_rbf = 1000000;
10043-
10044-
let mut btcd_controller = BitcoinCoreController::from_stx_config(&conf);
10045-
btcd_controller
10046-
.start_bitcoind()
10047-
.expect("Failed starting bitcoind");
10048-
10049-
let btc_regtest_controller = BitcoinRegtestController::new(conf, None);
10050-
10051-
btc_regtest_controller.bootstrap_chain(201);
10052-
10053-
eprintln!("Chain bootstrapped...");
10054-
10055-
btcd_controller
10056-
.stop_bitcoind()
10057-
.expect("Failed to stop bitcoind");
10058-
10059-
thread::sleep(Duration::from_secs(5));
10060-
10061-
btcd_controller
10062-
.start_bitcoind()
10063-
.expect("Failed to start bitcoind");
10064-
10065-
btcd_controller
10066-
.stop_bitcoind()
10067-
.expect("Failed to stop bitcoind");
10068-
}

0 commit comments

Comments
 (0)