Move TestRig into its own crate

This commit is contained in:
Paul Hauner 2019-01-27 14:22:51 +11:00
parent 79d1b15afc
commit e3115d2105
No known key found for this signature in database
GPG Key ID: D362883A9218FCC6
9 changed files with 32 additions and 5 deletions

View File

@ -16,6 +16,7 @@ members = [
"beacon_node", "beacon_node",
"beacon_node/db", "beacon_node/db",
"beacon_node/beacon_chain", "beacon_node/beacon_chain",
"beacon_node/beacon_chain/test_harness",
"protos", "protos",
"validator_client", "validator_client",
] ]

View File

@ -0,0 +1,22 @@
[package]
name = "test_harness"
version = "0.1.0"
authors = ["Paul Hauner <paul@paulhauner.com>"]
edition = "2018"
[dependencies]
beacon_chain = { path = "../../beacon_chain" }
block_producer = { path = "../../../eth2/block_producer" }
bls = { path = "../../../eth2/utils/bls" }
boolean-bitfield = { path = "../../../eth2/utils/boolean-bitfield" }
db = { path = "../../db" }
failure = "0.1"
failure_derive = "0.1"
genesis = { path = "../../../eth2/genesis" }
hashing = { path = "../../../eth2/utils/hashing" }
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
slot_clock = { path = "../../../eth2/utils/slot_clock" }
ssz = { path = "../../../eth2/utils/ssz" }
types = { path = "../../../eth2/types" }

View File

@ -2,7 +2,6 @@ use super::TestValidator;
pub use beacon_chain::dump::{Error as DumpError, SlotDump}; pub use beacon_chain::dump::{Error as DumpError, SlotDump};
use beacon_chain::BeaconChain; use beacon_chain::BeaconChain;
use block_producer::BeaconNode; use block_producer::BeaconNode;
#[cfg(test)]
use db::{ use db::{
stores::{BeaconBlockStore, BeaconStateStore}, stores::{BeaconBlockStore, BeaconStateStore},
MemoryDB, MemoryDB,

View File

@ -1,6 +1,5 @@
use super::{BenchingBeaconNode, DirectDuties}; use super::{BenchingBeaconNode, DirectDuties};
use beacon_chain::BeaconChain; use beacon_chain::BeaconChain;
#[cfg(test)]
use block_producer::{test_utils::TestSigner, BlockProducer, Error as PollError}; use block_producer::{test_utils::TestSigner, BlockProducer, Error as PollError};
use db::MemoryDB; use db::MemoryDB;
use slot_clock::TestingSlotClock; use slot_clock::TestingSlotClock;

View File

@ -1,11 +1,17 @@
use self::utils::TestRig; use test_harness::TestRig;
use types::ChainSpec; use types::ChainSpec;
mod utils; #[test]
fn it_can_build_on_genesis_block() {
let validator_count = 2;
let mut rig = TestRig::new(ChainSpec::foundation(), validator_count);
rig.advance_chain_with_block();
}
#[test] #[test]
#[ignore] #[ignore]
fn it_can_produce_blocks() { fn it_can_produce_past_first_epoch_boundary() {
let validator_count = 2; let validator_count = 2;
let mut rig = TestRig::new(ChainSpec::foundation(), validator_count); let mut rig = TestRig::new(ChainSpec::foundation(), validator_count);