Fix slow tests.
GitHub CI macos-latest sporadically fails these tests.
This commit is contained in:
parent
51dfcc8c1a
commit
4fd0d761b6
|
@ -222,10 +222,12 @@ fn concurrent_read_write() {
|
|||
if status.is_err() {
|
||||
panic!("{status}");
|
||||
}
|
||||
|
||||
app.exit();
|
||||
}
|
||||
|
||||
// tests
|
||||
let threads: Vec<_> = (0..32)
|
||||
let threads: Vec<_> = (0..10)
|
||||
.map(|_| {
|
||||
std::thread::spawn(clmv!(file, || {
|
||||
let mut app = APP.defaults().run_headless(false);
|
||||
|
@ -241,6 +243,8 @@ fn concurrent_read_write() {
|
|||
var.set("custom").unwrap();
|
||||
app.update(false).assert_wait();
|
||||
}
|
||||
|
||||
app.exit();
|
||||
}))
|
||||
})
|
||||
.collect();
|
||||
|
@ -285,6 +289,8 @@ fn fallback_swap() {
|
|||
if status.is_err() {
|
||||
panic!("{status}");
|
||||
}
|
||||
|
||||
app.exit();
|
||||
}
|
||||
|
||||
// test
|
||||
|
@ -316,6 +322,8 @@ fn fallback_swap() {
|
|||
}
|
||||
|
||||
assert_eq!("main", key.get());
|
||||
|
||||
app.exit();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -351,6 +359,8 @@ fn fallback_reset() {
|
|||
if status.is_err() {
|
||||
panic!("{status}");
|
||||
}
|
||||
|
||||
app.exit();
|
||||
}
|
||||
|
||||
// test
|
||||
|
@ -384,6 +394,8 @@ fn fallback_reset() {
|
|||
panic!("{status}");
|
||||
}
|
||||
assert_eq!("fallback", key.get());
|
||||
|
||||
app.exit();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -419,6 +431,8 @@ fn fallback_reset_entry() {
|
|||
if status.is_err() {
|
||||
panic!("{status}");
|
||||
}
|
||||
|
||||
app.exit();
|
||||
}
|
||||
|
||||
// test
|
||||
|
@ -465,6 +479,8 @@ fn fallback_reset_entry() {
|
|||
|
||||
let raw_config = std::fs::read_to_string(&main_cfg).unwrap();
|
||||
assert!(!raw_config.contains("key"));
|
||||
|
||||
app.exit();
|
||||
}
|
||||
|
||||
fn rmv_file_assert(path: &Path) {
|
||||
|
|
|
@ -1309,7 +1309,7 @@ mod response {
|
|||
fn race_condition() {
|
||||
let mut app = APP.minimal().run_headless(false);
|
||||
|
||||
for _ in 0..100 {
|
||||
for _ in 0..10 {
|
||||
let a = task::respond(async {
|
||||
task::deadline(1.ms()).await;
|
||||
'a'
|
||||
|
@ -1327,7 +1327,7 @@ mod response {
|
|||
});
|
||||
|
||||
let ab = app
|
||||
.run_task(async { task::with_deadline(ab.wait_into_rsp(), 40.secs()).await })
|
||||
.run_task(async { task::with_deadline(ab.wait_into_rsp(), 20.secs()).await })
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
|
||||
|
|
|
@ -211,6 +211,7 @@ fn doc(mut args: Vec<&str>) {
|
|||
// do test, t [-u, --unit <function-path>]
|
||||
// [-t, --test <integration-test-name>]
|
||||
// [-m, --macro <file-path-pattern>]
|
||||
// [--nextest]
|
||||
// <cargo-test-args>
|
||||
//
|
||||
// Run all tests in root workspace and macro tests.
|
||||
|
@ -230,7 +231,9 @@ fn doc(mut args: Vec<&str>) {
|
|||
// test --doc
|
||||
// Run doc tests.
|
||||
// test
|
||||
// Run all unit, doc, integration and macro tests.
|
||||
// Run all unit, integration, doc, and macro tests.
|
||||
// test --nextest
|
||||
// Run all unit and integration using 'nextest'; doc and macro tests using 'test'.
|
||||
fn test(mut args: Vec<&str>) {
|
||||
let nightly = if take_flag(&mut args, &["+nightly"]) { "+nightly" } else { "" };
|
||||
let env = &[("RUST_BACKTRACE", "full")];
|
||||
|
@ -331,6 +334,17 @@ fn test(mut args: Vec<&str>) {
|
|||
}
|
||||
|
||||
if take_flag(&mut args, &["--nextest"]) {
|
||||
if !args.contains(&"--config-file") {
|
||||
let cfg_file = "target/tmp/do-nextest-config.toml";
|
||||
std::fs::create_dir_all("target/tmp/").unwrap();
|
||||
std::fs::write(
|
||||
cfg_file,
|
||||
b"[profile.default]\nslow-timeout = { period = \"60s\", terminate-after = 3 }",
|
||||
)
|
||||
.unwrap();
|
||||
args.push("--config-file");
|
||||
args.push(cfg_file);
|
||||
}
|
||||
cmd_env(
|
||||
"cargo",
|
||||
&[nightly, "nextest", "run", "--no-fail-fast", "--all-features"],
|
||||
|
|
Loading…
Reference in New Issue