Skip to content

Commit

Permalink
chore: fix upgrade_prompt test on main (denoland#21314)
Browse files Browse the repository at this point in the history
Issue was main does canary builds, which broke this test because it
didn't handle searching for a canary release. Tested by building as
canary locally.
  • Loading branch information
dsherret authored Nov 23, 2023
1 parent 68a0877 commit d8961a9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cli/tests/integration/upgrade_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,11 @@ fn upgrade_prompt() {
// - We need to use a pty here because the upgrade prompt
// doesn't occur except when there's a pty.
// - Version comes from the test server.
pty.expect(" 99999.99.99 Run `deno upgrade` to install it.");
pty.expect_any(&[
" 99999.99.99 Run `deno upgrade` to install it.",
// it builds canary releases on main, so check for this in that case
"Run `deno upgrade --canary` to install it.",
]);
});
}

Expand Down
17 changes: 17 additions & 0 deletions test_util/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1282,6 +1282,15 @@ async fn main_server(
.unwrap(),
);
}
(&hyper::Method::GET, "/upgrade/sleep/canary-latest.txt") => {
tokio::time::sleep(Duration::from_secs(45)).await;
return Ok(
Response::builder()
.status(StatusCode::OK)
.body(Body::from("bda3850f84f24b71e02512c1ba2d6bf2e3daa2fd"))
.unwrap(),
);
}
(&hyper::Method::GET, "/release-latest.txt") => {
return Ok(
Response::builder()
Expand All @@ -1291,6 +1300,14 @@ async fn main_server(
.unwrap(),
);
}
(&hyper::Method::GET, "/canary-latest.txt") => {
return Ok(
Response::builder()
.status(StatusCode::OK)
.body(Body::from("bda3850f84f24b71e02512c1ba2d6bf2e3daa2fd"))
.unwrap(),
);
}
_ => {
let mut file_path = testdata_path().to_path_buf();
file_path.push(&req.uri().path()[1..].replace("%2f", "/"));
Expand Down

0 comments on commit d8961a9

Please sign in to comment.