From d8961a9dfe7f07b90e69efd29bfb86adf765dace Mon Sep 17 00:00:00 2001 From: David Sherret Date: Thu, 23 Nov 2023 12:54:27 -0500 Subject: chore: fix upgrade_prompt test on main (#21314) 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. --- cli/tests/integration/upgrade_tests.rs | 6 +++++- test_util/src/lib.rs | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/cli/tests/integration/upgrade_tests.rs b/cli/tests/integration/upgrade_tests.rs index 9b0ad30bd..0d41a1649 100644 --- a/cli/tests/integration/upgrade_tests.rs +++ b/cli/tests/integration/upgrade_tests.rs @@ -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.", + ]); }); } diff --git a/test_util/src/lib.rs b/test_util/src/lib.rs index c38f2bb0f..0f402fb52 100644 --- a/test_util/src/lib.rs +++ b/test_util/src/lib.rs @@ -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() @@ -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", "/")); -- cgit v1.2.3