moves scanner-results-reader to zebra-scan, adds zebrad bin to zebra-scan, adds a short sleep before trying to connect to gRPC server in test
This commit is contained in:
parent
ec5e685be5
commit
e2af3cb365
|
@ -6042,9 +6042,11 @@ dependencies = [
|
|||
"ff",
|
||||
"futures",
|
||||
"group",
|
||||
"hex",
|
||||
"indexmap 2.2.6",
|
||||
"insta",
|
||||
"itertools 0.13.0",
|
||||
"jsonrpc",
|
||||
"jubjub",
|
||||
"lazy_static",
|
||||
"proptest",
|
||||
|
@ -6189,7 +6191,6 @@ dependencies = [
|
|||
"zebra-chain",
|
||||
"zebra-node-services",
|
||||
"zebra-rpc",
|
||||
"zebra-scan",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -6256,7 +6257,6 @@ dependencies = [
|
|||
"zebra-network",
|
||||
"zebra-node-services",
|
||||
"zebra-rpc",
|
||||
"zebra-scan",
|
||||
"zebra-state",
|
||||
"zebra-test",
|
||||
"zebra-utils",
|
||||
|
|
|
@ -23,6 +23,16 @@ required-features = ["proptest-impl"]
|
|||
name = "zebra-scanner"
|
||||
path = "src/bin/scanner/main.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "scanning-results-reader"
|
||||
path = "src/bin/scanning-results-reader/main.rs"
|
||||
required-features = ["results-reader"]
|
||||
|
||||
[[bin]] # Bin to run zebrad, used in tests
|
||||
name = "zebrad"
|
||||
path = "src/bin/zebrad/main.rs"
|
||||
required-features = ["proptest-impl"]
|
||||
|
||||
[features]
|
||||
|
||||
# Production features that activate extra dependencies, or extra features in dependencies
|
||||
|
@ -41,10 +51,14 @@ proptest-impl = [
|
|||
"jubjub",
|
||||
"rand",
|
||||
"zcash_note_encryption",
|
||||
"zebrad"
|
||||
]
|
||||
|
||||
# Needed for the zebra-scanner binary.
|
||||
shielded-scan = []
|
||||
results-reader = [
|
||||
"jsonrpc",
|
||||
"hex"
|
||||
]
|
||||
|
||||
[dependencies]
|
||||
|
||||
|
@ -91,6 +105,11 @@ structopt = "0.3.26"
|
|||
lazy_static = "1.4.0"
|
||||
serde_json = "1.0.117"
|
||||
|
||||
jsonrpc = { version = "0.18.0", optional = true }
|
||||
hex = { version = "0.4.3", optional = true }
|
||||
|
||||
zebrad = { path = "../zebrad", version = "1.8.0", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
insta = { version = "1.39.0", features = ["ron", "redactions"] }
|
||||
tokio = { version = "1.37.0", features = ["test-util"] }
|
||||
|
@ -109,5 +128,4 @@ tonic = "0.11.0"
|
|||
|
||||
zebra-state = { path = "../zebra-state", version = "1.0.0-beta.38", features = ["proptest-impl"] }
|
||||
zebra-test = { path = "../zebra-test", version = "1.0.0-beta.38" }
|
||||
zebrad = { path = "../zebrad", version = "1.8.0" }
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
//! Main entry point for Zebrad, to be used in zebra-scan tests
|
||||
|
||||
use zebrad::application::{boot, APPLICATION};
|
||||
|
||||
/// Process entry point for `zebrad`
|
||||
fn main() {
|
||||
boot(&APPLICATION);
|
||||
}
|
|
@ -38,10 +38,11 @@ fn scanner_help() -> eyre::Result<()> {
|
|||
/// export CARGO_BIN_EXE_zebrad="/path/to/zebrad_binary"
|
||||
/// cargo test scan_binary_starts -- --ignored --nocapture
|
||||
/// ```
|
||||
#[ignore]
|
||||
#[tokio::test]
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
async fn scan_binary_starts() -> Result<()> {
|
||||
use std::time::Duration;
|
||||
|
||||
let _init_guard = zebra_test::init();
|
||||
|
||||
// Create a directory to dump test data into it.
|
||||
|
@ -95,6 +96,9 @@ async fn scan_binary_starts() -> Result<()> {
|
|||
// Check scanner was started.
|
||||
zebra_scanner.expect_stdout_line_matches("loaded Zebra scanner cache")?;
|
||||
|
||||
// Wait for the scanner's gRPC server to start up
|
||||
tokio::time::sleep(Duration::from_secs(1)).await;
|
||||
|
||||
// Check if the grpc server is up
|
||||
let mut client = ScannerClient::connect(format!("http://{listen_addr}")).await?;
|
||||
let request = tonic::Request::new(Empty {});
|
||||
|
@ -246,11 +250,7 @@ where
|
|||
args.merge_with(extra_args);
|
||||
|
||||
if zebrad {
|
||||
self.spawn_child_with_command(
|
||||
&std::env::var("CARGO_BIN_EXE_zebrad")
|
||||
.expect("please set CARGO_BIN_EXE_zebrad env var to a zebrad path"),
|
||||
args,
|
||||
)
|
||||
self.spawn_child_with_command(env!("CARGO_BIN_EXE_zebrad"), args)
|
||||
} else {
|
||||
self.spawn_child_with_command(env!("CARGO_BIN_EXE_zebra-scanner"), args)
|
||||
}
|
||||
|
|
|
@ -36,11 +36,6 @@ name = "block-template-to-proposal"
|
|||
path = "src/bin/block-template-to-proposal/main.rs"
|
||||
required-features = ["getblocktemplate-rpcs"]
|
||||
|
||||
[[bin]]
|
||||
name = "scanning-results-reader"
|
||||
path = "src/bin/scanning-results-reader/main.rs"
|
||||
required-features = ["shielded-scan"]
|
||||
|
||||
[[bin]]
|
||||
name = "openapi-generator"
|
||||
path = "src/bin/openapi-generator/main.rs"
|
||||
|
@ -76,7 +71,6 @@ shielded-scan = [
|
|||
"jsonrpc",
|
||||
"zcash_primitives",
|
||||
"zcash_client_backend",
|
||||
"zebra-scan"
|
||||
]
|
||||
|
||||
openapi-generator = [
|
||||
|
@ -102,7 +96,6 @@ thiserror = "1.0.61"
|
|||
|
||||
zebra-node-services = { path = "../zebra-node-services", version = "1.0.0-beta.38" }
|
||||
zebra-chain = { path = "../zebra-chain", version = "1.0.0-beta.38" }
|
||||
zebra-scan = { path = "../zebra-scan", version = "0.1.0-alpha.7", optional = true }
|
||||
|
||||
# These crates are needed for the block-template-to-proposal binary
|
||||
zebra-rpc = { path = "../zebra-rpc", version = "1.0.0-beta.38", optional = true }
|
||||
|
|
|
@ -77,9 +77,6 @@ internal-miner = [
|
|||
"zebra-rpc/getblocktemplate-rpcs",
|
||||
]
|
||||
|
||||
# Experimental shielded blockchain scanning
|
||||
shielded-scan = ["zebra-scan"]
|
||||
|
||||
# Experimental elasticsearch indexing
|
||||
elasticsearch = [
|
||||
"zebra-state/elasticsearch",
|
||||
|
@ -127,7 +124,6 @@ proptest-impl = [
|
|||
"zebra-state/proptest-impl",
|
||||
"zebra-network/proptest-impl",
|
||||
"zebra-chain/proptest-impl",
|
||||
"zebra-scan?/proptest-impl",
|
||||
]
|
||||
|
||||
# Build the zebra-checkpoints utility for checkpoint generation tests
|
||||
|
@ -165,9 +161,6 @@ zebra-node-services = { path = "../zebra-node-services", version = "1.0.0-beta.3
|
|||
zebra-rpc = { path = "../zebra-rpc", version = "1.0.0-beta.38" }
|
||||
zebra-state = { path = "../zebra-state", version = "1.0.0-beta.38" }
|
||||
|
||||
# Experimental shielded-scan feature
|
||||
zebra-scan = { path = "../zebra-scan", version = "0.1.0-alpha.7", optional = true }
|
||||
|
||||
# Required for crates.io publishing, but it's only used in tests
|
||||
zebra-utils = { path = "../zebra-utils", version = "1.0.0-beta.38", optional = true }
|
||||
|
||||
|
@ -283,7 +276,6 @@ color-eyre = { version = "0.6.3" }
|
|||
zebra-chain = { path = "../zebra-chain", version = "1.0.0-beta.38", features = ["proptest-impl"] }
|
||||
zebra-consensus = { path = "../zebra-consensus", version = "1.0.0-beta.38", features = ["proptest-impl"] }
|
||||
zebra-network = { path = "../zebra-network", version = "1.0.0-beta.38", features = ["proptest-impl"] }
|
||||
zebra-scan = { path = "../zebra-scan", version = "0.1.0-alpha.7", features = ["proptest-impl"] }
|
||||
zebra-state = { path = "../zebra-state", version = "1.0.0-beta.38", features = ["proptest-impl"] }
|
||||
|
||||
zebra-test = { path = "../zebra-test", version = "1.0.0-beta.38" }
|
||||
|
|
Loading…
Reference in New Issue