1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

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
This commit is contained in:
David Sherret 2024-05-22 10:13:37 -04:00 committed by GitHub
parent 596a2996cf
commit f891d16493
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -9,8 +9,12 @@ use std::path::Path;
use std::time::Duration; use std::time::Duration;
use std::time::Instant; use std::time::Instant;
use once_cell::sync::Lazy;
use crate::strip_ansi_codes; 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: /// Points to know about when writing pty tests:
/// ///
/// - Consecutive writes cause issues where you might write while a prompt /// - Consecutive writes cause issues where you might write while a prompt
@ -54,7 +58,7 @@ impl Pty {
pub fn is_supported() -> bool { pub fn is_supported() -> bool {
let is_windows = cfg!(windows); 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 // the pty tests don't really start up on the windows CI for some reason
// so ignore them for now // so ignore them for now
eprintln!("Ignoring windows CI."); eprintln!("Ignoring windows CI.");
@ -209,7 +213,7 @@ impl Pty {
#[track_caller] #[track_caller]
fn read_until_condition(&mut self, condition: impl FnMut(&mut Self) -> bool) { 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) Duration::from_secs(30)
} else { } else {
Duration::from_secs(15) Duration::from_secs(15)
@ -268,7 +272,12 @@ impl Pty {
self.read_bytes.extend(&buf[..count]); 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
}));
} }
} }
} }