diff --git a/zebrad/tests/acceptance.rs b/zebrad/tests/acceptance.rs index 0d1af3fb78a..f2b8ea9bad7 100644 --- a/zebrad/tests/acceptance.rs +++ b/zebrad/tests/acceptance.rs @@ -2903,199 +2903,6 @@ async fn fully_synced_rpc_z_getsubtreesbyindex_snapshot_test() -> Result<()> { Ok(()) } -// TODO: Move this test once we have the new scanner binary. -// /// Test that the scanner task gets started when the node starts. -// #[test] -// #[cfg(feature = "shielded-scan")] -// fn scan_task_starts() -> Result<()> { -// use indexmap::IndexMap; -// use zebra_scan::tests::ZECPAGES_SAPLING_VIEWING_KEY; - -// let _init_guard = zebra_test::init(); - -// let test_type = TestType::LaunchWithEmptyState { -// launches_lightwalletd: false, -// }; -// let mut config = default_test_config(&Mainnet)?; -// let mut keys = IndexMap::new(); -// keys.insert(ZECPAGES_SAPLING_VIEWING_KEY.to_string(), 1); -// config.shielded_scan.sapling_keys_to_scan = keys; - -// // Start zebra with the config. -// let mut zebrad = testdir()? -// .with_exact_config(&config)? -// .spawn_child(args!["start"])? -// .with_timeout(test_type.zebrad_timeout()); - -// // Check scanner was started. -// zebrad.expect_stdout_line_matches("loaded Zebra scanner cache")?; - -// // Look for 2 scanner notices indicating we are below sapling activation. -// zebrad.expect_stdout_line_matches("scanner is waiting for Sapling activation. Current tip: [0-9]{1,4}, Sapling activation: 419200")?; -// zebrad.expect_stdout_line_matches("scanner is waiting for Sapling activation. Current tip: [0-9]{1,4}, Sapling activation: 419200")?; - -// // Kill the node. -// zebrad.kill(false)?; - -// // Check that scan task started and the first scanning is done. -// let output = zebrad.wait_with_output()?; - -// // Make sure the command was killed -// output.assert_was_killed()?; -// output.assert_failure()?; - -// Ok(()) -// } - -// TODO: Move this test once we have the new scanner binary. -// /// Test that the scanner gRPC server starts when the node starts. -// #[tokio::test] -// #[cfg(all(feature = "shielded-scan", not(target_os = "windows")))] -// async fn scan_rpc_server_starts() -> Result<()> { -// use zebra_grpc::scanner::{scanner_client::ScannerClient, Empty}; - -// let _init_guard = zebra_test::init(); - -// let test_type = TestType::LaunchWithEmptyState { -// launches_lightwalletd: false, -// }; - -// let port = random_known_port(); -// let listen_addr = format!("127.0.0.1:{port}"); -// let mut config = default_test_config(&Mainnet)?; -// config.shielded_scan.listen_addr = Some(listen_addr.parse()?); - -// // Start zebra with the config. -// let mut zebrad = testdir()? -// .with_exact_config(&config)? -// .spawn_child(args!["start"])? -// .with_timeout(test_type.zebrad_timeout()); - -// // Wait until gRPC server is starting. -// tokio::time::sleep(LAUNCH_DELAY).await; -// zebrad.expect_stdout_line_matches("starting scan gRPC server")?; -// tokio::time::sleep(Duration::from_secs(1)).await; - -// let mut client = ScannerClient::connect(format!("http://{listen_addr}")).await?; - -// let request = tonic::Request::new(Empty {}); - -// client.get_info(request).await?; - -// // Kill the node. -// zebrad.kill(false)?; - -// // Check that scan task started and the first scanning is done. -// let output = zebrad.wait_with_output()?; - -// // Make sure the command was killed -// output.assert_was_killed()?; -// output.assert_failure()?; - -// Ok(()) -// } - -// TODO: Move this test once we have the new scanner binary. -// /// Test that the scanner can continue scanning where it was left when zebrad restarts. -// /// -// /// Needs a cache state close to the tip. A possible way to run it locally is: -// /// -// /// export ZEBRA_CACHED_STATE_DIR="/path/to/zebra/state" -// /// cargo test scan_start_where_left --features="shielded-scan" -- --ignored --nocapture -// /// -// /// The test will run zebrad with a key to scan, scan the first few blocks after sapling and then stops. -// /// Then it will restart zebrad and check that it resumes scanning where it was left. -// /// -// /// Note: This test will remove all the contents you may have in the ZEBRA_CACHED_STATE_DIR/private-scan directory -// /// so it can start with an empty scanning state. -// #[ignore] -// #[test] -// #[cfg(feature = "shielded-scan")] -// fn scan_start_where_left() -> Result<()> { -// use indexmap::IndexMap; -// use zebra_scan::{storage::db::SCANNER_DATABASE_KIND, tests::ZECPAGES_SAPLING_VIEWING_KEY}; - -// let _init_guard = zebra_test::init(); - -// // use `UpdateZebraCachedStateNoRpc` as the test type to make sure a zebrad cache state is available. -// let test_type = TestType::UpdateZebraCachedStateNoRpc; -// if let Some(cache_dir) = test_type.zebrad_state_path("scan test") { -// // Add a key to the config -// let mut config = default_test_config(&Mainnet)?; -// let mut keys = IndexMap::new(); -// keys.insert(ZECPAGES_SAPLING_VIEWING_KEY.to_string(), 1); -// config.shielded_scan.sapling_keys_to_scan = keys; - -// // Add the cache dir to shielded scan, make it the same as the zebrad cache state. -// config -// .shielded_scan -// .db_config_mut() -// .cache_dir -// .clone_from(&cache_dir); -// config.shielded_scan.db_config_mut().ephemeral = false; - -// // Add the cache dir to state. -// config.state.cache_dir.clone_from(&cache_dir); -// config.state.ephemeral = false; - -// // Remove the scan directory before starting. -// let scan_db_path = cache_dir.join(SCANNER_DATABASE_KIND); -// fs::remove_dir_all(std::path::Path::new(&scan_db_path)).ok(); - -// // Start zebra with the config. -// let mut zebrad = testdir()? -// .with_exact_config(&config)? -// .spawn_child(args!["start"])? -// .with_timeout(test_type.zebrad_timeout()); - -// // Check scanner was started. -// zebrad.expect_stdout_line_matches("loaded Zebra scanner cache")?; - -// // The first time -// zebrad.expect_stdout_line_matches( -// r"Scanning the blockchain for key 0, started at block 419200, now at block 420000", -// )?; - -// // Make sure scanner scans a few blocks. -// zebrad.expect_stdout_line_matches( -// r"Scanning the blockchain for key 0, started at block 419200, now at block 430000", -// )?; -// zebrad.expect_stdout_line_matches( -// r"Scanning the blockchain for key 0, started at block 419200, now at block 440000", -// )?; - -// // Kill the node. -// zebrad.kill(false)?; -// let output = zebrad.wait_with_output()?; - -// // Make sure the command was killed -// output.assert_was_killed()?; -// output.assert_failure()?; - -// // Start the node again. -// let mut zebrad = testdir()? -// .with_exact_config(&config)? -// .spawn_child(args!["start"])? -// .with_timeout(test_type.zebrad_timeout()); - -// // Resuming message. -// zebrad.expect_stdout_line_matches( -// "Last scanned height for key number 0 is 439000, resuming at 439001", -// )?; -// zebrad.expect_stdout_line_matches("loaded Zebra scanner cache")?; - -// // Start scanning where it was left. -// zebrad.expect_stdout_line_matches( -// r"Scanning the blockchain for key 0, started at block 439001, now at block 440000", -// )?; -// zebrad.expect_stdout_line_matches( -// r"Scanning the blockchain for key 0, started at block 439001, now at block 450000", -// )?; -// } - -// Ok(()) -// } - // TODO: Add this test to CI (#8236) /// Tests successful: /// - Registration of a new key,