Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TEST: Turn each twins scenario into a separate test case (#133)
## What ❔ Instead of running multiple Twins scenarios in a loop inside a single test, we use the `#[test_casing]` macro to reify scenarios as test cases, except for the test which runs up to 100 scenarios looking for a counter example (which for me came after ~25 scenarios) and splitting wouldn't make sense. ## Why ❔ So that scenarios take individually less time, and are potentially easier to reproduce (eg. jump to scenario 10 which failed). ### Example ```console ❯ cargo nextest run -p zksync_consensus_bft twins Compiling zksync_consensus_bft v0.1.0 (/Users/aakoshh/Work/matter-labs/era-consensus/node/actors/bft) Finished `test` profile [unoptimized + debuginfo] target(s) in 2.52s Starting 76 tests across 1 binary (67 skipped; run ID: 9352ff1c-ce88-4a10-b15f-0efdf3f3a250, nextest profile: default) PASS [ 0.023s] zksync_consensus_bft testonly::twins::tests::prop_twin PASS [ 0.025s] zksync_consensus_bft testonly::twins::tests::prop_cluster PASS [ 0.023s] zksync_consensus_bft testonly::twins::tests::test_splits PASS [ 0.029s] zksync_consensus_bft testonly::twins::tests::test_scenario_generator PASS [ 0.390s] zksync_consensus_bft testonly::twins::tests::prop_splits PASS [ 0.588s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_00 PASS [ 0.613s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_04 PASS [ 0.653s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_09 PASS [ 0.700s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_05 PASS [ 0.731s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_06 PASS [ 0.806s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_07 PASS [ 0.942s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_01 PASS [ 1.082s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_11 PASS [ 1.191s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_08 PASS [ 1.282s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_02 PASS [ 0.706s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_14 PASS [ 0.847s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_15 PASS [ 0.933s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_13 PASS [ 0.712s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_18 PASS [ 1.720s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_03 PASS [ 1.355s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_12 PASS [ 1.116s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_16 PASS [ 1.815s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_10 PASS [ 1.107s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_17 PASS [ 0.798s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_21 PASS [ 0.963s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_20 PASS [ 1.349s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_19 PASS [ 1.125s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_23 PASS [ 1.070s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_24 PASS [ 0.891s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_27 PASS [ 1.111s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_25 PASS [ 0.968s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_28 PASS [ 0.916s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_29 PASS [ 1.313s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_26 PASS [ 1.348s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_30 PASS [ 1.183s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_33 PASS [ 1.405s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_31 PASS [ 1.007s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_34 PASS [ 2.051s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_22 PASS [ 0.989s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_37 PASS [ 1.078s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_36 PASS [ 1.103s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_39 PASS [ 1.454s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_35 PASS [ 1.289s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_38 PASS [ 1.476s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_41 PASS [ 2.318s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_32 PASS [ 1.435s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_42 PASS [ 1.404s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_45 PASS [ 1.529s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_43 PASS [ 1.507s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_46 PASS [ 2.316s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_40 PASS [ 0.400s] zksync_consensus_bft tests::twins_network_wo_twins_w_partitions::case_0 PASS [ 1.545s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_47 PASS [ 1.395s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_49 PASS [ 2.030s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_44 PASS [ 0.557s] zksync_consensus_bft tests::twins_network_wo_twins_w_partitions::case_1 PASS [ 0.511s] zksync_consensus_bft tests::twins_network_wo_twins_w_partitions::case_2 PASS [ 0.326s] zksync_consensus_bft tests::twins_network_wo_twins_wo_partitions::case_0 PASS [ 0.323s] zksync_consensus_bft tests::twins_network_wo_twins_wo_partitions::case_1 PASS [ 0.445s] zksync_consensus_bft tests::twins_network_wo_twins_w_partitions::case_4 PASS [ 0.324s] zksync_consensus_bft tests::twins_network_wo_twins_wo_partitions::case_2 PASS [ 0.284s] zksync_consensus_bft tests::twins_network_wo_twins_wo_partitions::case_3 PASS [ 0.563s] zksync_consensus_bft tests::twins_network_wo_twins_w_partitions::case_3 PASS [ 1.974s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_48 PASS [ 0.317s] zksync_consensus_bft tests::twins_network_wo_twins_wo_partitions::case_4 PASS [ 0.325s] zksync_consensus_bft tests::twins_network_wo_twins_wo_partitions::case_5 PASS [ 0.332s] zksync_consensus_bft tests::twins_network_wo_twins_wo_partitions::case_6 PASS [ 0.332s] zksync_consensus_bft tests::twins_network_wo_twins_wo_partitions::case_7 PASS [ 0.315s] zksync_consensus_bft tests::twins_network_wo_twins_wo_partitions::case_8 PASS [ 0.310s] zksync_consensus_bft tests::twins_network_wo_twins_wo_partitions::case_9 PASS [ 3.078s] zksync_consensus_bft tests::twins_network_w2_twins_w_partitions::case_0 PASS [ 3.160s] zksync_consensus_bft tests::twins_network_w2_twins_w_partitions::case_3 PASS [ 3.632s] zksync_consensus_bft tests::twins_network_w2_twins_w_partitions::case_1 PASS [ 3.463s] zksync_consensus_bft tests::twins_network_w2_twins_w_partitions::case_4 PASS [ 3.758s] zksync_consensus_bft tests::twins_network_w2_twins_w_partitions::case_2 PASS [ 10.296s] zksync_consensus_bft tests::twins_network_to_fail ------------ Summary [ 10.304s] 76 tests run: 76 passed, 67 skipped ❯ cargo nextest run -p zksync_consensus_bft twins_network_w1_twins_w_partitions::case_37 Compiling zksync_consensus_bft v0.1.0 (/Users/aakoshh/Work/matter-labs/era-consensus/node/actors/bft) Finished `test` profile [unoptimized + debuginfo] target(s) in 0.89s Starting 1 test across 1 binary (142 skipped; run ID: 596b7941-05f4-4821-a679-1f7a37cd346b, nextest profile: default) PASS [ 0.572s] zksync_consensus_bft tests::twins_network_w1_twins_w_partitions::case_37 ------------ Summary [ 0.573s] 1 test run: 1 passed, 142 skipped ```
- Loading branch information