Skip to content

Commit

Permalink
Temporarily make the test run faster and with debug info
Browse files Browse the repository at this point in the history
  • Loading branch information
teor2345 committed Apr 23, 2023
1 parent cf6fb10 commit 3a01761
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
6 changes: 4 additions & 2 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ case "$1" in
#
# List directory used by test
ls -lh "$ZEBRA_CACHED_STATE_DIR"/*/* || (echo "No $ZEBRA_CACHED_STATE_DIR/*/*"; ls -lhR "$ZEBRA_CACHED_STATE_DIR" | head -50 || echo "No $ZEBRA_CACHED_STATE_DIR directory")
cargo test --locked --release --features "$ENTRYPOINT_FEATURES" --package zebrad --test acceptance -- --nocapture --include-ignored generate_checkpoints_mainnet
# BLOCKER: remove extra env vars before merging this PR
RUST_LOG=debug LOG_ZEBRAD_CHECKPOINTS=1 cargo test --locked --release --features "$ENTRYPOINT_FEATURES" --package zebrad --test acceptance -- --nocapture --include-ignored generate_checkpoints_mainnet
elif [[ "$GENERATE_CHECKPOINTS_TESTNET" -eq "1" ]]; then
# Generate checkpoints after syncing Zebra on testnet.
# The cached state is optional: it makes the test finish in minutes rather than hours.
Expand All @@ -74,7 +75,8 @@ case "$1" in
#
# List directory used by test
ls -lh "$ZEBRA_CACHED_STATE_DIR"/*/* || (echo "No $ZEBRA_CACHED_STATE_DIR/*/*"; ls -lhR "$ZEBRA_CACHED_STATE_DIR" | head -50 || echo "No $ZEBRA_CACHED_STATE_DIR directory")
cargo test --locked --release --features "$ENTRYPOINT_FEATURES" --package zebrad --test acceptance -- --nocapture --include-ignored generate_checkpoints_testnet
# BLOCKER: remove extra env vars before merging this PR
RUST_LOG=debug LOG_ZEBRAD_CHECKPOINTS=1 cargo test --locked --release --features "$ENTRYPOINT_FEATURES" --package zebrad --test acceptance -- --nocapture --include-ignored generate_checkpoints_testnet

elif [[ "$TEST_LWD_RPC_CALL" -eq "1" ]]; then
# Starting at a cached Zebra tip, test a JSON-RPC call to Zebra.
Expand Down
13 changes: 9 additions & 4 deletions zebrad/tests/common/checkpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ pub async fn run(network: Network) -> Result<()> {
);
zebrad.expect_stdout_line_matches(&format!("Opened RPC endpoint at {zebra_rpc_address}"))?;

// BLOCKER: re-enable before merging this PR
/*
tracing::info!(
?network,
?zebra_rpc_address,
Expand All @@ -119,15 +121,16 @@ pub async fn run(network: Network) -> Result<()> {
zebrad.expect_stdout_line_matches(SYNC_FINISHED_REGEX)?;
let zebra_tip_height = zebrad_tip_height(zebra_rpc_address).await?;

tracing::info!(
?network,
?zebra_rpc_address,
?zebra_tip_height,
?last_checkpoint,
"zebrad synced to the tip, launching zebra-checkpoints...",
);
*/

let zebra_tip_height = zebrad_tip_height(zebra_rpc_address).await?;
let zebra_checkpoints =
spawn_zebra_checkpoints_direct(network, test_type, zebra_rpc_address, last_checkpoint)?;

Expand Down Expand Up @@ -192,7 +195,7 @@ pub fn spawn_zebra_checkpoints_direct(
// Currently unused, but we might put a copy of the checkpoints file in it later
let zebra_checkpoints_dir = testdir()?;

let mut zebra_checkpoints = zebra_checkpoints_dir
let zebra_checkpoints = zebra_checkpoints_dir
.spawn_zebra_checkpoints_child(arguments)?
.with_timeout(test_type.zebrad_timeout())
.with_failure_regex_iter(
Expand All @@ -203,7 +206,9 @@ pub fn spawn_zebra_checkpoints_direct(
// zebra-checkpoints logs to stderr when it launches.
//
// This log happens very quickly, so it is ok to block for a short while here.
zebra_checkpoints.expect_stderr_line_matches(regex::escape("calculating checkpoints"))?;
//
// BLOCKER: re-enable before merging this PR
//zebra_checkpoints.expect_stderr_line_matches(regex::escape("calculating checkpoints"))?;

Ok(zebra_checkpoints)
}
Expand Down

0 comments on commit 3a01761

Please sign in to comment.