Skip to content

Commit

Permalink
Remove redundant Ok(()) assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
moshababo committed Nov 21, 2023
1 parent b489f0f commit ebbcc39
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions node/actors/bft/src/tests/unit_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,15 @@ async fn replica_prepare_sanity() {
let mut util = UTHarness::new().await;

let replica_prepare = util.new_replica_prepare(|_| {});
let res = util.dispatch_replica_prepare(replica_prepare);
assert_matches!(res, Ok(()));
util.dispatch_replica_prepare(replica_prepare).unwrap();
}

#[tokio::test]
async fn replica_prepare_sanity_yield_leader_prepare() {
let mut util = UTHarness::new().await;

let replica_prepare = util.new_replica_prepare(|_| {});
let res = util.dispatch_replica_prepare(replica_prepare);
assert_matches!(res, Ok(()));
util.dispatch_replica_prepare(replica_prepare).unwrap();
let _ = util.recv_leader_prepare().await.unwrap();
}

Expand Down Expand Up @@ -178,12 +176,9 @@ async fn leader_prepare_sanity() {
let mut util = UTHarness::new().await;

let replica_prepare = util.new_replica_prepare(|_| {});
let res = util.dispatch_replica_prepare(replica_prepare);
assert_matches!(res, Ok(()));
util.dispatch_replica_prepare(replica_prepare).unwrap();
let leader_prepare = util.recv_signed().await.unwrap();
let res = util.dispatch_leader_prepare(leader_prepare).await;

assert_matches!(res, Ok(()));
util.dispatch_leader_prepare(leader_prepare).await.unwrap();
}

#[tokio::test]
Expand All @@ -207,8 +202,7 @@ async fn leader_prepare_invalid_leader() {
);

let replica_prepare_two = util.key_at(1).sign_msg(replica_prepare_one.msg);
let res = util.dispatch_replica_prepare(replica_prepare_two);
assert_matches!(res, Ok(()));
util.dispatch_replica_prepare(replica_prepare_two).unwrap();

let mut leader_prepare = util.recv_leader_prepare().await.unwrap();
leader_prepare.view = leader_prepare.view.next();
Expand Down Expand Up @@ -251,8 +245,7 @@ async fn leader_prepare_invalid_prepare_qc_different_views() {
let mut util = UTHarness::new().await;

let replica_prepare = util.new_replica_prepare(|_| {});
let res = util.dispatch_replica_prepare(replica_prepare.clone());
assert_matches!(res, Ok(()));
util.dispatch_replica_prepare(replica_prepare.clone()).unwrap();

let mut leader_prepare = util.recv_leader_prepare().await.unwrap();
leader_prepare.view = leader_prepare.view.next();
Expand Down

0 comments on commit ebbcc39

Please sign in to comment.