chore: add upgrade prompt integration test (#21273)

1. Adds an upgrade prompt integration test.
1. Adds a test for when the upgrade check takes a long time in the repl.
This commit is contained in:
David Sherret 2023-11-23 11:20:40 -05:00 committed by GitHub
parent bf42467e21
commit eda3850f84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 86 additions and 1 deletions

View file

@ -635,6 +635,9 @@ impl TestCommandBuilder {
if !envs.contains_key("NPM_CONFIG_REGISTRY") {
envs.insert("NPM_CONFIG_REGISTRY".to_string(), npm_registry_unset_url());
}
if !envs.contains_key("DENO_NO_UPDATE_CHECK") {
envs.insert("DENO_NO_UPDATE_CHECK".to_string(), "1".to_string());
}
for key in &self.envs_remove {
envs.remove(key);
}

View file

@ -1273,6 +1273,24 @@ async fn main_server(
.unwrap(),
)
}
(&hyper::Method::GET, "/upgrade/sleep/release-latest.txt") => {
tokio::time::sleep(Duration::from_secs(45)).await;
return Ok(
Response::builder()
.status(StatusCode::OK)
.body(Body::from("99999.99.99"))
.unwrap(),
);
}
(&hyper::Method::GET, "/release-latest.txt") => {
return Ok(
Response::builder()
.status(StatusCode::OK)
// use a deno version that will never happen
.body(Body::from("99999.99.99"))
.unwrap(),
);
}
_ => {
let mut file_path = testdata_path().to_path_buf();
file_path.push(&req.uri().path()[1..].replace("%2f", "/"));