Skip to content

Commit

Permalink
Update sc-service-test tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
shamil-gadelshin committed Apr 9, 2024
1 parent c27a37e commit 8fdcc7f
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions substrate/client/service/test/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1165,7 +1165,7 @@ fn finalizing_diverged_block_should_trigger_reorg() {

// G -> A1 -> A2
// \
// -> B1 -> B2
// -> B1 -> B2 -> B3

let mut finality_notifications = client.finality_notification_stream();

Expand Down Expand Up @@ -1250,8 +1250,8 @@ fn finalizing_diverged_block_should_trigger_reorg() {

ClientExt::finalize_block(&client, b3.hash(), None).unwrap();

finality_notification_check(&mut finality_notifications, &[b1.hash()], &[]);
finality_notification_check(&mut finality_notifications, &[b2.hash(), b3.hash()], &[a2.hash()]);
finality_notification_check(&mut finality_notifications, &[b1.hash()], &[a2.hash()]);
finality_notification_check(&mut finality_notifications, &[b2.hash(), b3.hash()], &[]);
assert!(matches!(finality_notifications.try_recv().unwrap_err(), TryRecvError::Empty));
}

Expand Down Expand Up @@ -1372,8 +1372,12 @@ fn finality_notifications_content() {
// Import and finalize D4
block_on(client.import_as_final(BlockOrigin::Own, d4.clone())).unwrap();

finality_notification_check(&mut finality_notifications, &[a1.hash(), a2.hash()], &[c1.hash()]);
finality_notification_check(&mut finality_notifications, &[d3.hash(), d4.hash()], &[b2.hash()]);
finality_notification_check(
&mut finality_notifications,
&[a1.hash(), a2.hash()],
&[c1.hash(), b2.hash()],
);
finality_notification_check(&mut finality_notifications, &[d3.hash(), d4.hash()], &[a3.hash()]);
assert!(matches!(finality_notifications.try_recv().unwrap_err(), TryRecvError::Empty));
}

Expand Down Expand Up @@ -1602,9 +1606,9 @@ fn doesnt_import_blocks_that_revert_finality() {
block_on(client.import(BlockOrigin::Own, a3.clone())).unwrap();
ClientExt::finalize_block(&client, a3.hash(), None).unwrap();

finality_notification_check(&mut finality_notifications, &[a1.hash(), a2.hash()], &[]);
finality_notification_check(&mut finality_notifications, &[a1.hash(), a2.hash()], &[b2.hash()]);

finality_notification_check(&mut finality_notifications, &[a3.hash()], &[b2.hash()]);
finality_notification_check(&mut finality_notifications, &[a3.hash()], &[]);

assert!(matches!(finality_notifications.try_recv().unwrap_err(), TryRecvError::Empty));
}
Expand Down

0 comments on commit 8fdcc7f

Please sign in to comment.