Skip to content

Commit

Permalink
Add a sync acceptance test for the Testnet
Browse files Browse the repository at this point in the history
  • Loading branch information
teor2345 committed Oct 9, 2020
1 parent eaf5473 commit 5d374eb
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions zebrad/tests/acceptance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use tempdir::TempDir;

use std::{borrow::Borrow, fs, io::Write, time::Duration};

use zebra_chain::parameters::Network::{self, *};
use zebra_test::prelude::*;
use zebrad::config::ZebradConfig;

Expand Down Expand Up @@ -453,14 +454,30 @@ fn valid_generated_config(command: &str, expected_output: &str) -> Result<()> {

#[test]
#[ignore]
fn sync_one_checkpoint() -> Result<()> {
fn sync_one_checkpoint_mainnet() -> Result<()> {
sync_one_checkpoint(Mainnet)
}

#[test]
#[ignore]
fn sync_one_checkpoint_testnet() -> Result<()> {
sync_one_checkpoint(Testnet)
}

fn sync_one_checkpoint(network: Network) -> Result<()> {
zebra_test::init();

let mut config = persistent_test_config()?;
// TODO: add a convenience method?
config.network.network = network;

let mut child = testdir()?
.with_config(persistent_test_config()?)?
.with_config(config)?
.spawn_child(&["start"])?
.with_timeout(Duration::from_secs(20));

// TODO: is there a way to check for testnet or mainnet here?
// For example: "network=Mainnet" or "network=Testnet"
child.expect_stdout("verified checkpoint range")?;
child.kill()?;

Expand Down

0 comments on commit 5d374eb

Please sign in to comment.