Disable mempool large sync test unless specifically requested (#2924)

This matches the settings for `sync_large_checkpoints_mainnet`.

Also reduce the number of blocks synced to reduce network load.

Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
This commit is contained in:
teor 2021-10-21 22:30:11 +10:00 committed by GitHub
parent 192a45ccf1
commit fc4a2664fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 17 deletions

View File

@ -692,6 +692,9 @@ fn valid_generated_config(command: &str, expect_stdout_line_contains: &str) -> R
Ok(()) Ok(())
} }
const TINY_CHECKPOINT_TEST_HEIGHT: Height = Height(0);
const MEDIUM_CHECKPOINT_TEST_HEIGHT: Height =
Height(zebra_consensus::MAX_CHECKPOINT_HEIGHT_GAP as u32);
const LARGE_CHECKPOINT_TEST_HEIGHT: Height = const LARGE_CHECKPOINT_TEST_HEIGHT: Height =
Height((zebra_consensus::MAX_CHECKPOINT_HEIGHT_GAP * 2) as u32); Height((zebra_consensus::MAX_CHECKPOINT_HEIGHT_GAP * 2) as u32);
@ -705,7 +708,7 @@ const STOP_ON_LOAD_TIMEOUT: Duration = Duration::from_secs(10);
/// The maximum amount of time Zebra should take to sync a few hundred blocks. /// The maximum amount of time Zebra should take to sync a few hundred blocks.
/// ///
/// Usually the small checkpoint is much shorter than this. /// Usually the small checkpoint is much shorter than this.
const SMALL_CHECKPOINT_TIMEOUT: Duration = Duration::from_secs(120); const TINY_CHECKPOINT_TIMEOUT: Duration = Duration::from_secs(120);
/// The maximum amount of time Zebra should take to sync a thousand blocks. /// The maximum amount of time Zebra should take to sync a thousand blocks.
const LARGE_CHECKPOINT_TIMEOUT: Duration = Duration::from_secs(180); const LARGE_CHECKPOINT_TIMEOUT: Duration = Duration::from_secs(180);
@ -716,10 +719,10 @@ const LARGE_CHECKPOINT_TIMEOUT: Duration = Duration::from_secs(180);
#[test] #[test]
fn sync_one_checkpoint_mainnet() -> Result<()> { fn sync_one_checkpoint_mainnet() -> Result<()> {
sync_until( sync_until(
Height(0), TINY_CHECKPOINT_TEST_HEIGHT,
Mainnet, Mainnet,
STOP_AT_HEIGHT_REGEX, STOP_AT_HEIGHT_REGEX,
SMALL_CHECKPOINT_TIMEOUT, TINY_CHECKPOINT_TIMEOUT,
None, None,
true, true,
None, None,
@ -733,10 +736,10 @@ fn sync_one_checkpoint_mainnet() -> Result<()> {
#[test] #[test]
fn sync_one_checkpoint_testnet() -> Result<()> { fn sync_one_checkpoint_testnet() -> Result<()> {
sync_until( sync_until(
Height(0), TINY_CHECKPOINT_TEST_HEIGHT,
Testnet, Testnet,
STOP_AT_HEIGHT_REGEX, STOP_AT_HEIGHT_REGEX,
SMALL_CHECKPOINT_TIMEOUT, TINY_CHECKPOINT_TIMEOUT,
None, None,
true, true,
None, None,
@ -749,8 +752,8 @@ fn sync_one_checkpoint_testnet() -> Result<()> {
fn restart_stop_at_height() -> Result<()> { fn restart_stop_at_height() -> Result<()> {
zebra_test::init(); zebra_test::init();
restart_stop_at_height_for_network(Network::Mainnet, Height(0))?; restart_stop_at_height_for_network(Network::Mainnet, TINY_CHECKPOINT_TEST_HEIGHT)?;
restart_stop_at_height_for_network(Network::Testnet, Height(0))?; restart_stop_at_height_for_network(Network::Testnet, TINY_CHECKPOINT_TEST_HEIGHT)?;
Ok(()) Ok(())
} }
@ -760,7 +763,7 @@ fn restart_stop_at_height_for_network(network: Network, height: Height) -> Resul
height, height,
network, network,
STOP_AT_HEIGHT_REGEX, STOP_AT_HEIGHT_REGEX,
SMALL_CHECKPOINT_TIMEOUT, TINY_CHECKPOINT_TIMEOUT,
None, None,
true, true,
None, None,
@ -786,13 +789,13 @@ fn restart_stop_at_height_for_network(network: Network, height: Height) -> Resul
#[test] #[test]
fn activate_mempool_mainnet() -> Result<()> { fn activate_mempool_mainnet() -> Result<()> {
sync_until( sync_until(
Height(1), Height(TINY_CHECKPOINT_TEST_HEIGHT.0 + 1),
Mainnet, Mainnet,
STOP_AT_HEIGHT_REGEX, STOP_AT_HEIGHT_REGEX,
SMALL_CHECKPOINT_TIMEOUT, TINY_CHECKPOINT_TIMEOUT,
None, None,
true, true,
Some(Height(0)), Some(TINY_CHECKPOINT_TEST_HEIGHT),
) )
.map(|_tempdir| ()) .map(|_tempdir| ())
} }
@ -828,21 +831,23 @@ fn sync_large_checkpoints_mainnet() -> Result<()> {
Ok(()) Ok(())
} }
// TODO: We had a `sync_large_checkpoints_testnet` here but it was removed because // TODO: We had `sync_large_checkpoints_testnet` and `sync_large_checkpoints_mempool_testnet`,
// the testnet is unreliable (#1222). Enable after we have more testnet instances (#1791). // but they were removed because the testnet is unreliable (#1222).
// We should re-add them after we have more testnet instances (#1791).
/// Test if `zebrad` can run side by side with the mempool. /// Test if `zebrad` can run side by side with the mempool.
/// This is done by running the mempool and sync some large checkpoints. /// This is done by running the mempool and syncing some checkpoints.
#[test] #[test]
fn running_mempool_mainnet() -> Result<()> { #[ignore]
fn sync_large_checkpoints_mempool_mainnet() -> Result<()> {
sync_until( sync_until(
LARGE_CHECKPOINT_TEST_HEIGHT, MEDIUM_CHECKPOINT_TEST_HEIGHT,
Mainnet, Mainnet,
STOP_AT_HEIGHT_REGEX, STOP_AT_HEIGHT_REGEX,
LARGE_CHECKPOINT_TIMEOUT, LARGE_CHECKPOINT_TIMEOUT,
None, None,
true, true,
Some(Height(0)), Some(TINY_CHECKPOINT_TEST_HEIGHT),
) )
.map(|_tempdir| ()) .map(|_tempdir| ())
} }