Increase timeouts in processor tests

For some reason, these constantly failed for me while waiting for the key pair
to confirm. This adds a sleep during the mining process, to ensure blocks
actually have time between them, and mines several more blocks to handle the
median code recently added.
This commit is contained in:
Luke Parker 2023-11-25 04:09:07 -05:00
parent de14687a0d
commit c6c74684c9
No known key found for this signature in database
3 changed files with 11 additions and 9 deletions

View file

@ -233,7 +233,7 @@ impl Coordinator {
/// Receive a message from a processor as its coordinator.
pub async fn recv_message(&mut self) -> ProcessorMessage {
let msg = tokio::time::timeout(
core::time::Duration::from_secs(10),
core::time::Duration::from_secs(20),
self.queue.next(Service::Processor(self.network)),
)
.await

View file

@ -217,11 +217,12 @@ fn batch_test() {
let key_pair = key_gen(&mut coordinators, network).await;
// Now we we have to mine blocks to activate the key
// (the first key is activated when the coin's block time exceeds the Serai time it was
// confirmed at)
for _ in 0 .. confirmations(network) {
// (the first key is activated when the network's time as of a block exceeds the Serai time
// it was confirmed at)
// Mine multiple sets of medians to ensure the median is sufficiently advanced
for _ in 0 .. (10 * confirmations(network)) {
coordinators[0].add_block(&ops).await;
tokio::time::sleep(Duration::from_secs(1)).await;
}
coordinators[0].sync(&ops, &coordinators[1 ..]).await;

View file

@ -161,11 +161,12 @@ fn send_test() {
let key_pair = key_gen(&mut coordinators, network).await;
// Now we we have to mine blocks to activate the key
// (the first key is activated when the network's block time exceeds the Serai time it was
// confirmed at)
for _ in 0 .. confirmations(network) {
// (the first key is activated when the network's time as of a block exceeds the Serai time
// it was confirmed at)
// Mine multiple sets of medians to ensure the median is sufficiently advanced
for _ in 0 .. (10 * confirmations(network)) {
coordinators[0].add_block(&ops).await;
tokio::time::sleep(Duration::from_secs(1)).await;
}
coordinators[0].sync(&ops, &coordinators[1 ..]).await;