Skip to content

Commit

Permalink
Make CI tests more robust (#204)
Browse files Browse the repository at this point in the history
* Add retries to reduce flakiness.
* Reduce time spent on test sleeping.
  • Loading branch information
wmedrano authored Sep 9, 2024
1 parent 7adb0b1 commit fd5c16e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .config/nextest.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[profile.default]
test-threads = 1
fail-fast = false
slow-timeout = { period = "30s", terminate-after = 4 }
fail-fast = false
retries = { backoff = "fixed", count = 2, delay = "1s" }
2 changes: 1 addition & 1 deletion src/client/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ pub fn sleep_on_test() {
#[cfg(test)]
{
use std::{thread, time};
thread::sleep(time::Duration::from_millis(200));
thread::sleep(time::Duration::from_millis(100));
}
}
2 changes: 1 addition & 1 deletion src/client/test_callback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl ProcessHandler for Counter {
self.frames_since_cycle_start = ps.frames_since_cycle_start();
let _cycle_times = ps.cycle_times();
if self.induce_xruns {
thread::sleep(time::Duration::from_millis(400));
thread::sleep(time::Duration::from_millis(100));
self.induce_xruns = false;
}
self.process_thread = Some(thread::current().id());
Expand Down
3 changes: 0 additions & 3 deletions src/port/test_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ use crate::PORT_NAME_SIZE;
use std::collections::HashSet;
use std::sync::mpsc;
use std::sync::Mutex;
use std::{thread, time};

fn open_test_client(name: &str) -> Client {
Client::new(name, ClientOptions::NO_START_SERVER).unwrap().0
}
Expand Down Expand Up @@ -371,7 +369,6 @@ fn client_port_can_get_port_by_type_pattern() {

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

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

0 comments on commit fd5c16e

Please sign in to comment.