mirror of
https://github.com/serai-dex/serai.git
synced 2025-01-18 08:45:00 +00:00
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:
parent
de14687a0d
commit
c6c74684c9
3 changed files with 11 additions and 9 deletions
|
@ -233,7 +233,7 @@ impl Coordinator {
|
||||||
/// Receive a message from a processor as its coordinator.
|
/// Receive a message from a processor as its coordinator.
|
||||||
pub async fn recv_message(&mut self) -> ProcessorMessage {
|
pub async fn recv_message(&mut self) -> ProcessorMessage {
|
||||||
let msg = tokio::time::timeout(
|
let msg = tokio::time::timeout(
|
||||||
core::time::Duration::from_secs(10),
|
core::time::Duration::from_secs(20),
|
||||||
self.queue.next(Service::Processor(self.network)),
|
self.queue.next(Service::Processor(self.network)),
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
|
|
|
@ -217,11 +217,12 @@ fn batch_test() {
|
||||||
let key_pair = key_gen(&mut coordinators, network).await;
|
let key_pair = key_gen(&mut coordinators, network).await;
|
||||||
|
|
||||||
// Now we we have to mine blocks to activate the key
|
// 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
|
// (the first key is activated when the network's time as of a block exceeds the Serai time
|
||||||
// confirmed at)
|
// it was confirmed at)
|
||||||
|
// Mine multiple sets of medians to ensure the median is sufficiently advanced
|
||||||
for _ in 0 .. confirmations(network) {
|
for _ in 0 .. (10 * confirmations(network)) {
|
||||||
coordinators[0].add_block(&ops).await;
|
coordinators[0].add_block(&ops).await;
|
||||||
|
tokio::time::sleep(Duration::from_secs(1)).await;
|
||||||
}
|
}
|
||||||
coordinators[0].sync(&ops, &coordinators[1 ..]).await;
|
coordinators[0].sync(&ops, &coordinators[1 ..]).await;
|
||||||
|
|
||||||
|
|
|
@ -161,11 +161,12 @@ fn send_test() {
|
||||||
let key_pair = key_gen(&mut coordinators, network).await;
|
let key_pair = key_gen(&mut coordinators, network).await;
|
||||||
|
|
||||||
// Now we we have to mine blocks to activate the key
|
// 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
|
// (the first key is activated when the network's time as of a block exceeds the Serai time
|
||||||
// confirmed at)
|
// it was confirmed at)
|
||||||
|
// Mine multiple sets of medians to ensure the median is sufficiently advanced
|
||||||
for _ in 0 .. confirmations(network) {
|
for _ in 0 .. (10 * confirmations(network)) {
|
||||||
coordinators[0].add_block(&ops).await;
|
coordinators[0].add_block(&ops).await;
|
||||||
|
tokio::time::sleep(Duration::from_secs(1)).await;
|
||||||
}
|
}
|
||||||
coordinators[0].sync(&ops, &coordinators[1 ..]).await;
|
coordinators[0].sync(&ops, &coordinators[1 ..]).await;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue