Skip to content

Commit fd5c16e

Browse files
authored
Make CI tests more robust (#204)
* Add retries to reduce flakiness. * Reduce time spent on test sleeping.
1 parent 7adb0b1 commit fd5c16e

File tree

4 files changed

+4
-6
lines changed

4 files changed

+4
-6
lines changed

.config/nextest.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[profile.default]
22
test-threads = 1
3+
fail-fast = false
34
slow-timeout = { period = "30s", terminate-after = 4 }
4-
fail-fast = false
5+
retries = { backoff = "fixed", count = 2, delay = "1s" }

src/client/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ pub fn sleep_on_test() {
2424
#[cfg(test)]
2525
{
2626
use std::{thread, time};
27-
thread::sleep(time::Duration::from_millis(200));
27+
thread::sleep(time::Duration::from_millis(100));
2828
}
2929
}

src/client/test_callback.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl ProcessHandler for Counter {
5555
self.frames_since_cycle_start = ps.frames_since_cycle_start();
5656
let _cycle_times = ps.cycle_times();
5757
if self.induce_xruns {
58-
thread::sleep(time::Duration::from_millis(400));
58+
thread::sleep(time::Duration::from_millis(100));
5959
self.induce_xruns = false;
6060
}
6161
self.process_thread = Some(thread::current().id());

src/port/test_client.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ use crate::PORT_NAME_SIZE;
88
use std::collections::HashSet;
99
use std::sync::mpsc;
1010
use std::sync::Mutex;
11-
use std::{thread, time};
12-
1311
fn open_test_client(name: &str) -> Client {
1412
Client::new(name, ClientOptions::NO_START_SERVER).unwrap().0
1513
}
@@ -371,7 +369,6 @@ fn client_port_can_get_port_by_type_pattern() {
371369

372370
// register port with type name, like midi
373371
let _p = client.register_port(p_name, MidiIn);
374-
thread::sleep(time::Duration::from_millis(400));
375372

376373
// retrieve
377374
let ports = client.ports(None, Some("midi"), PortFlags::empty());

0 commit comments

Comments
 (0)