diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2024-05-22 10:13:37 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-22 10:13:37 -0400 |
commit | f891d1649360d1aa183a11d4ee36cf6ff3782354 (patch) | |
tree | 84c0dfc0d755ec139547ece3acbfd3c7bd2ccc98 /tests/util | |
parent | 596a2996cf777809fdefdb05a73a5b6253a5c285 (diff) |
chore(repl): maybe improve repl test flakiness on the CI (#23933)
These repl tests are still a bit flaky. Let's try this.
https://github.com/denoland/deno/actions/runs/9176525869/job/25232001263
Diffstat (limited to 'tests/util')
-rw-r--r-- | tests/util/server/src/pty.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/util/server/src/pty.rs b/tests/util/server/src/pty.rs index d6102c1d6..5d8049fee 100644 --- a/tests/util/server/src/pty.rs +++ b/tests/util/server/src/pty.rs @@ -9,8 +9,12 @@ use std::path::Path; use std::time::Duration; use std::time::Instant; +use once_cell::sync::Lazy; + use crate::strip_ansi_codes; +static IS_CI: Lazy<bool> = Lazy::new(|| std::env::var("CI").is_ok()); + /// Points to know about when writing pty tests: /// /// - Consecutive writes cause issues where you might write while a prompt @@ -54,7 +58,7 @@ impl Pty { pub fn is_supported() -> bool { let is_windows = cfg!(windows); - if is_windows && std::env::var("CI").is_ok() { + if is_windows && *IS_CI { // the pty tests don't really start up on the windows CI for some reason // so ignore them for now eprintln!("Ignoring windows CI."); @@ -209,7 +213,7 @@ impl Pty { #[track_caller] fn read_until_condition(&mut self, condition: impl FnMut(&mut Self) -> bool) { - let duration = if std::env::var_os("CI").is_some() { + let duration = if *IS_CI { Duration::from_secs(30) } else { Duration::from_secs(15) @@ -268,7 +272,12 @@ impl Pty { self.read_bytes.extend(&buf[..count]); } _ => { - std::thread::sleep(Duration::from_millis(15)); + // be a bit easier on the CI + std::thread::sleep(Duration::from_millis(if *IS_CI { + 100 + } else { + 20 + })); } } } |