diff options
author | Luca Casonato <hello@lcas.dev> | 2024-09-18 14:08:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-18 14:08:21 +0200 |
commit | 42e3a49cc7d20ea8f9ba8984c93a47b5c7174f0f (patch) | |
tree | ba2d99a8d64dd412118e4fd450406c614e429085 /tests/integration/upgrade_tests.rs | |
parent | 45b17947782986d2b3f2d9f192fdc079b468b4b0 (diff) |
tests: re-enable upgrade tests (#25680)
Diffstat (limited to 'tests/integration/upgrade_tests.rs')
-rw-r--r-- | tests/integration/upgrade_tests.rs | 189 |
1 files changed, 0 insertions, 189 deletions
diff --git a/tests/integration/upgrade_tests.rs b/tests/integration/upgrade_tests.rs index 0eb468a3f..5132b4ca5 100644 --- a/tests/integration/upgrade_tests.rs +++ b/tests/integration/upgrade_tests.rs @@ -5,198 +5,9 @@ use std::process::Stdio; use std::time::Instant; use test_util as util; use test_util::assert_starts_with; -use test_util::TempDir; use test_util::TestContext; use util::TestContextBuilder; -// Warning: this test requires internet access. -// TODO(#7412): reenable. test is flaky -#[test] -#[ignore] -fn upgrade_in_tmpdir() { - let temp_dir = TempDir::new(); - let exe_path = temp_dir.path().join("deno"); - util::deno_exe_path().copy(&exe_path); - assert!(exe_path.exists()); - let _mtime1 = std::fs::metadata(&exe_path).unwrap().modified().unwrap(); - let status = Command::new(&exe_path) - .arg("upgrade") - .arg("--force") - .spawn() - .unwrap() - .wait() - .unwrap(); - assert!(status.success()); - let _mtime2 = std::fs::metadata(&exe_path).unwrap().modified().unwrap(); - // TODO(ry) assert!(mtime1 < mtime2); -} - -// Warning: this test requires internet access. -// TODO(#7412): reenable. test is flaky -#[test] -#[ignore] -fn upgrade_with_space_in_path() { - let temp_dir = TempDir::new_with_prefix("directory with spaces"); - let exe_path = temp_dir.path().join("deno"); - util::deno_exe_path().copy(&exe_path); - assert!(exe_path.exists()); - let status = Command::new(&exe_path) - .arg("upgrade") - .arg("--force") - .env("TMP", temp_dir.path()) - .spawn() - .unwrap() - .wait() - .unwrap(); - assert!(status.success()); -} - -// Warning: this test requires internet access. -// TODO(#7412): reenable. test is flaky -#[test] -#[ignore] -fn upgrade_with_version_in_tmpdir() { - let temp_dir = TempDir::new(); - let exe_path = temp_dir.path().join("deno"); - util::deno_exe_path().copy(&exe_path); - assert!(exe_path.exists()); - let _mtime1 = std::fs::metadata(&exe_path).unwrap().modified().unwrap(); - let status = Command::new(&exe_path) - .arg("upgrade") - .arg("--force") - .arg("--version") - .arg("1.11.5") - .spawn() - .unwrap() - .wait() - .unwrap(); - assert!(status.success()); - let upgraded_deno_version = String::from_utf8( - Command::new(&exe_path).arg("-V").output().unwrap().stdout, - ) - .unwrap(); - assert!(upgraded_deno_version.contains("1.11.5")); - let _mtime2 = std::fs::metadata(&exe_path).unwrap().modified().unwrap(); - // TODO(ry) assert!(mtime1 < mtime2); -} - -// Warning: this test requires internet access. -// TODO(#7412): reenable. test is flaky -#[test] -#[ignore] -fn upgrade_with_canary_in_tmpdir() { - let temp_dir = TempDir::new(); - let exe_path = temp_dir.path().join("deno"); - util::deno_exe_path().copy(&exe_path); - assert!(exe_path.exists()); - let _mtime1 = std::fs::metadata(&exe_path).unwrap().modified().unwrap(); - let status = Command::new(&exe_path) - .arg("upgrade") - .arg("--canary") - .arg("--version") - .arg("e6685f0f01b8a11a5eaff020f5babcfde76b3038") - .spawn() - .unwrap() - .wait() - .unwrap(); - assert!(status.success()); - let upgraded_deno_version = String::from_utf8( - Command::new(&exe_path).arg("-V").output().unwrap().stdout, - ) - .unwrap(); - assert!(upgraded_deno_version.contains("e6685f0")); - let _mtime2 = std::fs::metadata(&exe_path).unwrap().modified().unwrap(); - // TODO(ry) assert!(mtime1 < mtime2); -} - -// Warning: this test requires internet access. -// TODO(#7412): reenable. test is flaky -#[test] -#[ignore] -fn upgrade_with_out_in_tmpdir() { - let temp_dir = TempDir::new(); - let exe_path = temp_dir.path().join("deno"); - let new_exe_path = temp_dir.path().join("foo"); - util::deno_exe_path().copy(&exe_path); - assert!(exe_path.exists()); - let mtime1 = std::fs::metadata(&exe_path).unwrap().modified().unwrap(); - let status = Command::new(&exe_path) - .arg("upgrade") - .arg("--version") - .arg("1.11.5") - .arg("--output") - .arg(&new_exe_path) - .spawn() - .unwrap() - .wait() - .unwrap(); - assert!(status.success()); - assert!(new_exe_path.exists()); - let mtime2 = std::fs::metadata(&exe_path).unwrap().modified().unwrap(); - assert_eq!(mtime1, mtime2); // Original exe_path was not changed. - - let v = String::from_utf8( - Command::new(&new_exe_path) - .arg("-V") - .output() - .unwrap() - .stdout, - ) - .unwrap(); - assert!(v.contains("1.11.5")); -} - -#[flaky_test::flaky_test] -fn upgrade_invalid_stable_version() { - let context = upgrade_context(); - let temp_dir = context.temp_dir(); - let exe_path = temp_dir.path().join("deno"); - util::deno_exe_path().copy(&exe_path); - assert!(exe_path.exists()); - exe_path.mark_executable(); - let output = Command::new(&exe_path) - .arg("upgrade") - .arg("--version") - .arg("foobar") - .stderr(Stdio::piped()) - .spawn() - .unwrap() - .wait_with_output() - .unwrap(); - assert!(!output.status.success()); - assert_starts_with!( - &util::strip_ansi_codes(&String::from_utf8(output.stderr.clone()).unwrap()) - .to_string(), - "error: Invalid version passed (foobar)" - ); -} - -#[flaky_test::flaky_test] -fn upgrade_invalid_canary_version() { - let context = upgrade_context(); - let temp_dir = context.temp_dir(); - let exe_path = temp_dir.path().join("deno"); - util::deno_exe_path().copy(&exe_path); - assert!(exe_path.exists()); - exe_path.mark_executable(); - let output = Command::new(&exe_path) - .arg("upgrade") - .arg("--canary") - .arg("--version") - .arg("foobar") - .stderr(Stdio::piped()) - .spawn() - .unwrap() - .wait_with_output() - .unwrap(); - assert!(!output.status.success()); - assert_starts_with!( - &util::strip_ansi_codes(&String::from_utf8(output.stderr.clone()).unwrap()) - .to_string(), - "error: Invalid commit hash passed (foobar)" - ); -} - #[flaky_test::flaky_test] fn upgrade_invalid_lockfile() { let context = upgrade_context(); |