Skip to content

Commit

Permalink
chore(repl): maybe improve repl test flakiness on the CI (denoland#23933
Browse files Browse the repository at this point in the history
)

These repl tests are still a bit flaky. Let's try this.

https://github.com/denoland/deno/actions/runs/9176525869/job/25232001263
  • Loading branch information
dsherret committed May 22, 2024
1 parent 596a299 commit f891d16
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions tests/util/server/src/pty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.");
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
}));
}
}
}
Expand Down

0 comments on commit f891d16

Please sign in to comment.