diff --git a/Cargo.toml b/Cargo.toml index e22d78d3cf..57b5de8ce3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,6 +16,7 @@ members = [ "beacon_node", "beacon_node/db", "beacon_node/beacon_chain", + "beacon_node/beacon_chain/test_harness", "protos", "validator_client", ] diff --git a/beacon_node/beacon_chain/test_harness/Cargo.toml b/beacon_node/beacon_chain/test_harness/Cargo.toml new file mode 100644 index 0000000000..6972e4df2d --- /dev/null +++ b/beacon_node/beacon_chain/test_harness/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "test_harness" +version = "0.1.0" +authors = ["Paul Hauner "] +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" } diff --git a/beacon_node/beacon_chain/tests/utils/benching_beacon_node.rs b/beacon_node/beacon_chain/test_harness/src/benching_beacon_node.rs similarity index 100% rename from beacon_node/beacon_chain/tests/utils/benching_beacon_node.rs rename to beacon_node/beacon_chain/test_harness/src/benching_beacon_node.rs diff --git a/beacon_node/beacon_chain/tests/utils/direct_beacon_node.rs b/beacon_node/beacon_chain/test_harness/src/direct_beacon_node.rs similarity index 100% rename from beacon_node/beacon_chain/tests/utils/direct_beacon_node.rs rename to beacon_node/beacon_chain/test_harness/src/direct_beacon_node.rs diff --git a/beacon_node/beacon_chain/tests/utils/direct_duties.rs b/beacon_node/beacon_chain/test_harness/src/direct_duties.rs similarity index 100% rename from beacon_node/beacon_chain/tests/utils/direct_duties.rs rename to beacon_node/beacon_chain/test_harness/src/direct_duties.rs diff --git a/beacon_node/beacon_chain/tests/utils/mod.rs b/beacon_node/beacon_chain/test_harness/src/lib.rs similarity index 100% rename from beacon_node/beacon_chain/tests/utils/mod.rs rename to beacon_node/beacon_chain/test_harness/src/lib.rs diff --git a/beacon_node/beacon_chain/tests/utils/test_rig.rs b/beacon_node/beacon_chain/test_harness/src/test_rig.rs similarity index 99% rename from beacon_node/beacon_chain/tests/utils/test_rig.rs rename to beacon_node/beacon_chain/test_harness/src/test_rig.rs index 7de2c4e564..f50f106980 100644 --- a/beacon_node/beacon_chain/tests/utils/test_rig.rs +++ b/beacon_node/beacon_chain/test_harness/src/test_rig.rs @@ -2,7 +2,6 @@ use super::TestValidator; pub use beacon_chain::dump::{Error as DumpError, SlotDump}; use beacon_chain::BeaconChain; use block_producer::BeaconNode; -#[cfg(test)] use db::{ stores::{BeaconBlockStore, BeaconStateStore}, MemoryDB, diff --git a/beacon_node/beacon_chain/tests/utils/validator.rs b/beacon_node/beacon_chain/test_harness/src/validator.rs similarity index 99% rename from beacon_node/beacon_chain/tests/utils/validator.rs rename to beacon_node/beacon_chain/test_harness/src/validator.rs index e4c0846a9a..1a04015425 100644 --- a/beacon_node/beacon_chain/tests/utils/validator.rs +++ b/beacon_node/beacon_chain/test_harness/src/validator.rs @@ -1,6 +1,5 @@ use super::{BenchingBeaconNode, DirectDuties}; use beacon_chain::BeaconChain; -#[cfg(test)] use block_producer::{test_utils::TestSigner, BlockProducer, Error as PollError}; use db::MemoryDB; use slot_clock::TestingSlotClock; diff --git a/beacon_node/beacon_chain/tests/chain.rs b/beacon_node/beacon_chain/test_harness/tests/chain.rs similarity index 63% rename from beacon_node/beacon_chain/tests/chain.rs rename to beacon_node/beacon_chain/test_harness/tests/chain.rs index 4aacf9ac18..6130f4c5db 100644 --- a/beacon_node/beacon_chain/tests/chain.rs +++ b/beacon_node/beacon_chain/test_harness/tests/chain.rs @@ -1,11 +1,17 @@ -use self::utils::TestRig; +use test_harness::TestRig; 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] #[ignore] -fn it_can_produce_blocks() { +fn it_can_produce_past_first_epoch_boundary() { let validator_count = 2; let mut rig = TestRig::new(ChainSpec::foundation(), validator_count);