Skip to content

Commit

Permalink
Merge pull request #3322 from input-output-hk/use-rest-for-wait-for-date
Browse files Browse the repository at this point in the history
tests: use rest api for wait for date
  • Loading branch information
Mikhail Zabaluev committed Jun 8, 2021
2 parents f1bbad6 + 6494cf3 commit 8f13215
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 114 deletions.
Expand Up @@ -26,7 +26,6 @@ pub fn test_mempool_pool_max_entries_limit() {
value: 100.into(),
},
])
.with_explorer()
.with_slot_duration(2)
.with_mempool(Mempool {
pool_max_entries: 1.into(),
Expand Down Expand Up @@ -89,7 +88,6 @@ pub fn test_mempool_pool_max_entries_equal_0() {
value: 100.into(),
},
])
.with_explorer()
.with_slot_duration(1)
.with_mempool(Mempool {
pool_max_entries: 0.into(),
Expand Down Expand Up @@ -124,7 +122,7 @@ pub fn test_mempool_pool_max_entries_equal_0() {
.unwrap()
.assert_empty();

time::wait_for_date(BlockDate::new(0, 5), jormungandr.explorer());
time::wait_for_date(BlockDate::new(0, 5), jormungandr.rest());
verifier.no_changes(vec![&sender, &receiver]).unwrap();
}

Expand All @@ -146,7 +144,6 @@ pub fn test_mempool_log_max_entries_only_one_fragment() {
value: 100.into(),
},
])
.with_explorer()
.with_slot_duration(1)
.with_mempool(Mempool {
pool_max_entries: 1.into(),
Expand Down Expand Up @@ -209,7 +206,6 @@ pub fn test_mempool_log_max_entries_equals_0() {
value: 100.into(),
},
])
.with_explorer()
.with_slot_duration(1)
.with_mempool(Mempool {
pool_max_entries: 0.into(),
Expand Down Expand Up @@ -244,7 +240,7 @@ pub fn test_mempool_log_max_entries_equals_0() {
.unwrap()
.assert_empty();

time::wait_for_date(BlockDate::new(0, 5), jormungandr.explorer());
time::wait_for_date(BlockDate::new(0, 5), jormungandr.rest());

verifier.no_changes(vec![&sender, &receiver]).unwrap();
}
Expand All @@ -267,7 +263,6 @@ pub fn test_mempool_pool_max_entries_overrides_log_max_entries() {
value: 100.into(),
},
])
.with_explorer()
.with_slot_duration(1)
.with_mempool(Mempool {
pool_max_entries: 2.into(),
Expand Down Expand Up @@ -302,7 +297,7 @@ pub fn test_mempool_pool_max_entries_overrides_log_max_entries() {
.unwrap()
.assert_size(2);

time::wait_for_date(BlockDate::new(0, 10), jormungandr.explorer());
time::wait_for_date(BlockDate::new(0, 10), jormungandr.rest());

verifier
.value_moved_between_wallets(&sender, &receiver, 2.into())
Expand Down
Expand Up @@ -26,7 +26,6 @@ pub fn test_mempool_pool_max_entries_limit() {
value: 100.into(),
},
])
.with_explorer()
.with_slot_duration(2)
.with_mempool(Mempool {
pool_max_entries: 1.into(),
Expand Down Expand Up @@ -109,7 +108,6 @@ pub fn test_mempool_pool_max_entries_equal_0() {
value: 100.into(),
},
])
.with_explorer()
.with_slot_duration(1)
.with_mempool(Mempool {
pool_max_entries: 0.into(),
Expand Down Expand Up @@ -164,7 +162,7 @@ pub fn test_mempool_pool_max_entries_equal_0() {
.unwrap()
.assert_empty();

time::wait_for_date(BlockDate::new(0, 10), jormungandr.explorer());
time::wait_for_date(BlockDate::new(0, 10), jormungandr.rest());
verifier.no_changes(vec![&sender, &receiver]).unwrap();
}

Expand All @@ -186,7 +184,6 @@ pub fn test_mempool_log_max_entries_only_one_fragment() {
value: 100.into(),
},
])
.with_explorer()
.with_slot_duration(1)
.with_mempool(Mempool {
pool_max_entries: 1.into(),
Expand Down Expand Up @@ -269,7 +266,6 @@ pub fn test_mempool_log_max_entries_equals_0() {
value: 100.into(),
},
])
.with_explorer()
.with_slot_duration(1)
.with_mempool(Mempool {
pool_max_entries: 0.into(),
Expand Down Expand Up @@ -324,7 +320,7 @@ pub fn test_mempool_log_max_entries_equals_0() {
.unwrap()
.assert_empty();

time::wait_for_date(BlockDate::new(0, 10), jormungandr.explorer());
time::wait_for_date(BlockDate::new(0, 10), jormungandr.rest());

verifier.no_changes(vec![&sender, &receiver]).unwrap();
}
Expand All @@ -347,7 +343,6 @@ pub fn test_mempool_pool_max_entries_overrides_log_max_entries() {
value: 100.into(),
},
])
.with_explorer()
.with_slot_duration(1)
.with_mempool(Mempool {
pool_max_entries: 2.into(),
Expand Down Expand Up @@ -402,7 +397,7 @@ pub fn test_mempool_pool_max_entries_overrides_log_max_entries() {
.unwrap()
.assert_size(2);

time::wait_for_date(BlockDate::new(0, 10), jormungandr.explorer());
time::wait_for_date(BlockDate::new(0, 10), jormungandr.rest());

verifier
.value_moved_between_wallets(&sender, &receiver, 2.into())
Expand Down
Expand Up @@ -48,7 +48,6 @@ pub fn send_all_fragments() {
sender,
receiver,
jormungandr.to_remote(),
jormungandr.explorer(),
time_era.slots_per_epoch(),
30,
30,
Expand All @@ -63,7 +62,7 @@ pub fn send_all_fragments() {
let wait = Wait::new(Duration::from_secs(1), 25);
fragment_check.wait_until_all_processed(&wait).unwrap();

time::wait_for_epoch(1, jormungandr.explorer());
time::wait_for_epoch(1, jormungandr.rest());

let mem_checks: Vec<MemPoolCheck> = fragment_generator.send_all().unwrap();
let verifier = FragmentVerifier;
Expand Down
Expand Up @@ -33,7 +33,7 @@ pub fn collect_reward() {
)
.unwrap();

time::wait_for_epoch(2, jormungandr.explorer());
time::wait_for_epoch(2, jormungandr.rest());

let stake_pools_data: Vec<StakePoolStats> = stake_pools
.iter()
Expand Down
Expand Up @@ -55,7 +55,6 @@ pub fn dump_send_correct_fragments() {
sender,
receiver,
jormungandr.to_remote(),
jormungandr.explorer(),
time_era.slots_per_epoch(),
2,
2,
Expand All @@ -65,7 +64,7 @@ pub fn dump_send_correct_fragments() {
fragment_generator.prepare(BlockDate::new(1, 0));
let verifier = FragmentVerifier;

time::wait_for_epoch(1, jormungandr.explorer());
time::wait_for_epoch(1, jormungandr.rest());

let wait = Wait::new(Duration::from_secs(1), 25);
verifier
Expand Down
Expand Up @@ -133,7 +133,7 @@ pub fn jcli_e2e_flow_private_vote() {
.parse::<u64>()
.unwrap();

time::wait_for_epoch(1, jormungandr.explorer());
time::wait_for_epoch(1, jormungandr.rest());

let vote_plan_id = jcli.certificate().vote_plan_id(&vote_plan_cert);
let yes_vote_cast = jcli.certificate().new_private_vote_cast(
Expand Down Expand Up @@ -192,7 +192,7 @@ pub fn jcli_e2e_flow_private_vote() {
.send(&tx)
.assert_in_block();

time::wait_for_epoch(2, jormungandr.explorer());
time::wait_for_epoch(2, jormungandr.rest());

let encrypted_vote_tally = temp_dir.child("encrypted-vote-tally.certificate");

Expand Down Expand Up @@ -269,7 +269,7 @@ pub fn jcli_e2e_flow_private_vote() {
.send(&tx)
.assert_in_block();

time::wait_for_epoch(3, jormungandr.explorer());
time::wait_for_epoch(3, jormungandr.rest());

let rewards_after = jormungandr
.explorer()
Expand Down
Expand Up @@ -197,7 +197,7 @@ pub fn test_vote_flow_bft() {
.parse::<u64>()
.unwrap();

wait_for_epoch(1, jormungandr.explorer());
wait_for_epoch(1, jormungandr.rest());

transaction_sender
.send_vote_tally(
Expand All @@ -208,7 +208,7 @@ pub fn test_vote_flow_bft() {
)
.unwrap();

wait_for_epoch(2, jormungandr.explorer());
wait_for_epoch(2, jormungandr.rest());

assert_first_proposal_has_votes(
2 * initial_fund_per_wallet,
Expand Down Expand Up @@ -311,7 +311,7 @@ pub fn test_vote_flow_praos() {
.send_vote_cast(&mut clarice, &vote_plan, 0, &no_choice, &jormungandr)
.unwrap();

wait_for_epoch(1, jormungandr.explorer());
wait_for_epoch(1, jormungandr.rest());

transaction_sender
.send_vote_tally(
Expand All @@ -322,7 +322,7 @@ pub fn test_vote_flow_praos() {
)
.unwrap();

wait_for_epoch(3, jormungandr.explorer());
wait_for_epoch(3, jormungandr.rest());

let rewards_after = jormungandr
.explorer()
Expand Down Expand Up @@ -439,7 +439,7 @@ pub fn jcli_e2e_flow() {
.parse::<u64>()
.unwrap();

time::wait_for_epoch(1, jormungandr.explorer());
time::wait_for_epoch(1, jormungandr.rest());

let vote_plan_id = jcli.certificate().vote_plan_id(&vote_plan_cert);
let vote_cast = jcli
Expand Down Expand Up @@ -486,7 +486,7 @@ pub fn jcli_e2e_flow() {
.send(&tx)
.assert_in_block();

time::wait_for_epoch(2, jormungandr.explorer());
time::wait_for_epoch(2, jormungandr.rest());

let vote_tally_cert = jcli.certificate().new_public_vote_tally(vote_plan_id);

Expand All @@ -504,7 +504,7 @@ pub fn jcli_e2e_flow() {
.send(&tx)
.assert_in_block();

time::wait_for_epoch(3, jormungandr.explorer());
time::wait_for_epoch(3, jormungandr.rest());

assert!(jormungandr
.rest()
Expand Down
Expand Up @@ -45,7 +45,6 @@ pub fn fragment_load_test() {
faucet,
receiver,
jormungandr.to_remote(),
jormungandr.explorer(),
60,
30,
30,
Expand All @@ -67,7 +66,7 @@ pub fn fragment_load_test() {
let wait = Wait::new(Duration::from_secs(1), 25);
fragment_check.wait_until_all_processed(&wait).unwrap();

time::wait_for_epoch(1, jormungandr.explorer());
time::wait_for_epoch(1, jormungandr.rest());

load::start_async(
request_generator,
Expand Down
Expand Up @@ -96,7 +96,6 @@ pub fn private_vote_load_scenario(quick_config: PrivateVotingLoadTestConfig) {
.with_committees(&[&committee])
.with_slots_per_epoch(quick_config.slots_in_epoch())
.with_certs(vec![vote_plan_cert])
.with_explorer()
.with_slot_duration(quick_config.slot_duration())
.with_block_content_max_size(quick_config.block_content_max_size())
.with_treasury(1_000.into())
Expand Down Expand Up @@ -144,10 +143,7 @@ pub fn private_vote_load_scenario(quick_config: PrivateVotingLoadTestConfig) {
Status::Green
);

wait_for_epoch(
quick_config.voting_timing()[1].into(),
jormungandr.explorer(),
);
wait_for_epoch(quick_config.voting_timing()[1], jormungandr.rest());

transaction_sender
.send_encrypted_tally(&mut committee, &vote_plan, &jormungandr)
Expand All @@ -158,7 +154,7 @@ pub fn private_vote_load_scenario(quick_config: PrivateVotingLoadTestConfig) {
quick_config.voting_timing()[1],
quick_config.slots_in_epoch() / 2,
),
jormungandr.explorer(),
jormungandr.rest(),
);

let active_vote_plans = jormungandr.rest().vote_plan_statuses().unwrap();
Expand All @@ -178,10 +174,7 @@ pub fn private_vote_load_scenario(quick_config: PrivateVotingLoadTestConfig) {
)
.unwrap();

wait_for_epoch(
quick_config.voting_timing()[2].into(),
jormungandr.explorer(),
);
wait_for_epoch(quick_config.voting_timing()[2], jormungandr.rest());
let active_vote_plans = jormungandr.rest().vote_plan_statuses().unwrap();

let vote_plan_status = active_vote_plans
Expand Down Expand Up @@ -269,7 +262,6 @@ pub fn adversary_private_vote_load_scenario(
.with_committees(&[&committee])
.with_slots_per_epoch(quick_config.slots_in_epoch())
.with_certs(vec![vote_plan_cert])
.with_explorer()
.with_slot_duration(quick_config.slot_duration())
.with_block_content_max_size(quick_config.block_content_max_size())
.with_treasury(1_000.into())
Expand Down Expand Up @@ -338,10 +330,7 @@ pub fn adversary_private_vote_load_scenario(
Status::Green
);

wait_for_epoch(
quick_config.voting_timing()[1].into(),
jormungandr.explorer(),
);
wait_for_epoch(quick_config.voting_timing()[1], jormungandr.rest());

transaction_sender
.send_encrypted_tally(&mut committee, &vote_plan, &jormungandr)
Expand All @@ -352,7 +341,7 @@ pub fn adversary_private_vote_load_scenario(
quick_config.voting_timing()[1],
quick_config.slots_in_epoch() / 2,
),
jormungandr.explorer(),
jormungandr.rest(),
);

let active_vote_plans = jormungandr.rest().vote_plan_statuses().unwrap();
Expand All @@ -372,10 +361,7 @@ pub fn adversary_private_vote_load_scenario(
)
.unwrap();

wait_for_epoch(
quick_config.voting_timing()[2].into(),
jormungandr.explorer(),
);
wait_for_epoch(quick_config.voting_timing()[2], jormungandr.rest());
let active_vote_plans = jormungandr.rest().vote_plan_statuses().unwrap();

let vote_plan_status = active_vote_plans
Expand Down

0 comments on commit 8f13215

Please sign in to comment.