Skip to content

Commit

Permalink
executor tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
pompon0 committed Dec 23, 2023
1 parent 2b4b992 commit 2b5808c
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions node/actors/executor/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ async fn executing_single_validator() {
let executor = validator.into_executor(storage.clone());

scope::run!(ctx, |ctx, s| async {
s.spawn_bg(storage.run_background_tasks(ctx));
s.spawn_bg(executor.run(ctx));
let want = BlockNumber(5);
sync::wait_for(ctx, &mut storage.subscribe(), |state| state.next() > want).await?;
Expand All @@ -100,6 +101,8 @@ async fn executing_validator_and_full_node() {
let full_node = full_node.into_executor(full_node_storage.clone());

scope::run!(ctx, |ctx, s| async {
s.spawn_bg(validator_storage.run_background_tasks(ctx));
s.spawn_bg(full_node_storage.run_background_tasks(ctx));
s.spawn_bg(validator.run(ctx));
s.spawn_bg(full_node.run(ctx));
let want = BlockNumber(5);
Expand All @@ -121,13 +124,7 @@ async fn syncing_full_node_from_snapshot(delay_block_storage: bool) {
let full_node = validator.connect_full_node(rng);

let blocks: Vec<_> = validator.gen_blocks(rng).take(11).collect();
let validator_storage = make_store(ctx,blocks[0].clone()).await;
if !delay_block_storage {
// Instead of running consensus on the validator, add the generated blocks manually.
for block in &blocks {
validator_storage.store_block(ctx, block.clone()).await.unwrap();
}
}
let validator_storage = make_store(ctx,blocks[0].clone()).await;
let validator = validator.node.into_executor(validator_storage.clone());

// Start a full node from a snapshot.
Expand All @@ -140,6 +137,14 @@ async fn syncing_full_node_from_snapshot(delay_block_storage: bool) {
};

scope::run!(ctx, |ctx, s| async {
s.spawn_bg(validator_storage.run_background_tasks(ctx));
s.spawn_bg(full_node_storage.run_background_tasks(ctx));
if !delay_block_storage {
// Instead of running consensus on the validator, add the generated blocks manually.
for block in &blocks {
validator_storage.store_block(ctx, block.clone()).await.unwrap();
}
}
s.spawn_bg(validator.run(ctx));
s.spawn_bg(full_node.run(ctx));

Expand Down

0 comments on commit 2b5808c

Please sign in to comment.