Skip to content

Commit

Permalink
fix(supervisor): failing tests, chores (#5070)
Browse files Browse the repository at this point in the history
* fix(supervisor): failing tests, chores
* test: fix `kura_not_miss_replace_block` again
---------
Signed-off-by: 0x009922 <[email protected]>
  • Loading branch information
0x009922 authored Sep 12, 2024
1 parent 50eb315 commit bc2f46b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion crates/iroha_core/src/gossiper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl TransactionGossiper {
self.handle_transaction_gossip(transaction_gossip);
}
() = shutdown_signal.receive() => {
iroha_logger::info!("Shutting down transactions gossiper");
iroha_logger::debug!("Shutting down transactions gossiper");
break;
},
}
Expand Down
15 changes: 10 additions & 5 deletions crates/iroha_core/src/kura.rs
Original file line number Diff line number Diff line change
Expand Up @@ -983,8 +983,8 @@ mod tests {
.unwrap();
}

#[tokio::test]
async fn kura_not_miss_replace_block() {
#[test]
fn kura_not_miss_replace_block() {
let rt = tokio::runtime::Builder::new_multi_thread()
.enable_time()
.build()
Expand Down Expand Up @@ -1063,7 +1063,10 @@ mod tests {
// Starting with empty block store
assert_eq!(block_count.0, 0);

let _handle = Kura::start(kura.clone(), ShutdownSignal::new());
let _handle = {
let _rt_guard = rt.enter();
Kura::start(kura.clone(), ShutdownSignal::new())
};

let state = State::new(
World::with([domain, genesis_domain], [account, genesis_account], []),
Expand Down Expand Up @@ -1133,8 +1136,8 @@ mod tests {
blocks.push(block.clone());
kura.store_block(block);
}
// Add wait so that previous block is written to the block store
thread::sleep(Duration::from_secs(1));
const BLOCK_FLUSH_TIMEOUT: Duration = Duration::from_secs(1);
thread::sleep(BLOCK_FLUSH_TIMEOUT);

{
let mut state_block = state.block_and_revert();
Expand All @@ -1151,6 +1154,7 @@ mod tests {
blocks.push(block_soft_fork.clone());
kura.replace_top_block(block_soft_fork);
}
thread::sleep(BLOCK_FLUSH_TIMEOUT);

{
let mut state_block: crate::state::StateBlock = state.block();
Expand All @@ -1167,6 +1171,7 @@ mod tests {
blocks.push(block_next.clone());
kura.store_block(block_next);
}
thread::sleep(BLOCK_FLUSH_TIMEOUT);

blocks
}
Expand Down
2 changes: 1 addition & 1 deletion crates/iroha_core/src/query/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl LiveQueryStore {
});
}
() = self.shutdown_signal.receive() => {
iroha_logger::info!("LiveQueryStore is being shut down.");
iroha_logger::debug!("LiveQueryStore is being shut down.");
break;
}
else => break,
Expand Down
4 changes: 2 additions & 2 deletions crates/iroha_futures/src/supervisor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,8 @@ mod tests {
.recv_timeout(OS_THREAD_SPAWN_TICK)
.expect("thread should start by now");
signal2.send();
timeout(TICK_TIMEOUT, sup_fut)
// It is too slow in CI sometimes
timeout(TICK_TIMEOUT * 10, sup_fut)
.await
.expect("should shutdown within timeout")
.expect("should not panic")
Expand All @@ -715,6 +716,5 @@ mod tests {
else {
panic!("no other error expected");
};
println!("hey");
}
}

0 comments on commit bc2f46b

Please sign in to comment.