diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-12-12 16:54:00 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-12 16:54:00 +0100 |
commit | 623bc22ad0aa7446bc383dc93d7c8da3c4c2fe22 (patch) | |
tree | ebf61b6716b3b8c9069e79478b1abf53a9dbcfa6 | |
parent | f4cf1b453846a28a306316d197c3c15a41594b33 (diff) |
Revert "chore(test): increase file watcher timeout duration on macOS (#8733)" (#8737)
This reverts commit f4cf1b453846a28a306316d197c3c15a41594b33.
-rw-r--r-- | cli/tests/integration_tests.rs | 93 |
1 files changed, 21 insertions, 72 deletions
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index f6c3ec632..eeffb0097 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -528,16 +528,8 @@ fn skip_restarting_line( } #[test] +#[ignore] fn fmt_watch_test() { - const TIMEOUT: std::time::Duration = - // Increase timeout duration to address flakiness on CI as much as possible - // See https://github.com/denoland/deno/issues/8571 - std::time::Duration::from_secs(if cfg!(target_os = "macos") { - 5 - } else { - 1 - }); - let t = TempDir::new().expect("tempdir fail"); let fixed = util::root_path().join("cli/tests/badly_formatted_fixed.js"); let badly_formatted_original = @@ -561,7 +553,7 @@ fn fmt_watch_test() { std::io::BufReader::new(stderr).lines().map(|r| r.unwrap()); // TODO(lucacasonato): remove this timeout. It seems to be needed on Linux. - std::thread::sleep(TIMEOUT); + std::thread::sleep(std::time::Duration::from_secs(1)); assert!(skip_restarting_line(stderr_lines).contains("badly_formatted.js")); @@ -572,7 +564,7 @@ fn fmt_watch_test() { // Change content of the file again to be badly formatted std::fs::copy(&badly_formatted_original, &badly_formatted) .expect("Failed to copy file"); - std::thread::sleep(TIMEOUT); + std::thread::sleep(std::time::Duration::from_secs(1)); // Check if file has been automatically formatted by watcher let expected = std::fs::read_to_string(fixed).unwrap(); @@ -1284,16 +1276,8 @@ fn bundle_import_map_no_check() { } #[test] +#[ignore] fn bundle_js_watch() { - const TIMEOUT: std::time::Duration = - // Increase timeout duration to address flakiness on CI as much as possible - // See https://github.com/denoland/deno/issues/8571 - std::time::Duration::from_secs(if cfg!(target_os = "macos") { - 5 - } else { - 1 - }); - use std::path::PathBuf; // Test strategy extends this of test bundle_js by adding watcher let t = TempDir::new().expect("tempdir fail"); @@ -1319,7 +1303,7 @@ fn bundle_js_watch() { let mut stderr_lines = std::io::BufReader::new(stderr).lines().map(|r| r.unwrap()); - std::thread::sleep(TIMEOUT); + std::thread::sleep(std::time::Duration::from_secs(1)); assert!(stderr_lines.next().unwrap().contains("file_to_watch.js")); assert!(stderr_lines.next().unwrap().contains("mod6.bundle.js")); let file = PathBuf::from(&bundle); @@ -1328,7 +1312,7 @@ fn bundle_js_watch() { std::fs::write(&file_to_watch, "console.log('Hello world2');") .expect("error writing file"); - std::thread::sleep(TIMEOUT); + std::thread::sleep(std::time::Duration::from_secs(1)); assert!(stderr_lines .next() .unwrap() @@ -1342,7 +1326,7 @@ fn bundle_js_watch() { // Confirm that the watcher keeps on working even if the file is updated and has invalid syntax std::fs::write(&file_to_watch, "syntax error ^^") .expect("error writing file"); - std::thread::sleep(TIMEOUT); + std::thread::sleep(std::time::Duration::from_secs(1)); assert!(stderr_lines .next() .unwrap() @@ -1362,16 +1346,8 @@ fn bundle_js_watch() { /// Confirm that the watcher continues to work even if module resolution fails at the *first* attempt #[test] +#[ignore] fn bundle_watch_not_exit() { - const TIMEOUT: std::time::Duration = - // Increase timeout duration to address flakiness on CI as much as possible - // See https://github.com/denoland/deno/issues/8571 - std::time::Duration::from_secs(if cfg!(target_os = "macos") { - 5 - } else { - 1 - }); - let t = TempDir::new().expect("tempdir fail"); let file_to_watch = t.path().join("file_to_watch.js"); std::fs::write(&file_to_watch, "syntax error ^^") @@ -1395,7 +1371,7 @@ fn bundle_watch_not_exit() { let mut stderr_lines = std::io::BufReader::new(stderr).lines().map(|r| r.unwrap()); - std::thread::sleep(TIMEOUT); + std::thread::sleep(std::time::Duration::from_secs(1)); assert!(stderr_lines.next().unwrap().contains("file_to_watch.js")); assert!(stderr_lines.next().unwrap().contains("error:")); assert!(stderr_lines.next().unwrap().contains("Bundle failed!")); @@ -1405,7 +1381,7 @@ fn bundle_watch_not_exit() { // Make sure the watcher actually restarts and works fine with the proper syntax std::fs::write(&file_to_watch, "console.log(42);") .expect("error writing file"); - std::thread::sleep(TIMEOUT); + std::thread::sleep(std::time::Duration::from_secs(1)); assert!(stderr_lines .next() .unwrap() @@ -1470,16 +1446,8 @@ fn wait_for_process_finished( } #[test] +#[ignore] fn run_watch() { - const TIMEOUT: std::time::Duration = - // Increase timeout duration to address flakiness on CI as much as possible - // See https://github.com/denoland/deno/issues/8571 - std::time::Duration::from_secs(if cfg!(target_os = "macos") { - 5 - } else { - 1 - }); - let t = TempDir::new().expect("tempdir fail"); let file_to_watch = t.path().join("file_to_watch.js"); std::fs::write(&file_to_watch, "console.log('Hello world');") @@ -1508,13 +1476,13 @@ fn run_watch() { wait_for_process_finished("Process", &mut stderr_lines); // TODO(lucacasonato): remove this timeout. It seems to be needed on Linux. - std::thread::sleep(TIMEOUT); + std::thread::sleep(std::time::Duration::from_secs(1)); // Change content of the file std::fs::write(&file_to_watch, "console.log('Hello world2');") .expect("error writing file"); // Events from the file watcher is "debounced", so we need to wait for the next execution to start - std::thread::sleep(TIMEOUT); + std::thread::sleep(std::time::Duration::from_secs(1)); assert!(stderr_lines.next().unwrap().contains("Restarting")); assert!(stdout_lines.next().unwrap().contains("Hello world2")); @@ -1529,7 +1497,7 @@ fn run_watch() { "import { foo } from './another_file.js'; console.log(foo);", ) .expect("error writing file"); - std::thread::sleep(TIMEOUT); + std::thread::sleep(std::time::Duration::from_secs(1)); assert!(stderr_lines.next().unwrap().contains("Restarting")); assert!(stdout_lines.next().unwrap().contains('0')); wait_for_process_finished("Process", &mut stderr_lines); @@ -1537,7 +1505,7 @@ fn run_watch() { // Confirm that restarting occurs when a new file is updated std::fs::write(&another_file, "export const foo = 42;") .expect("error writing file"); - std::thread::sleep(TIMEOUT); + std::thread::sleep(std::time::Duration::from_secs(1)); assert!(stderr_lines.next().unwrap().contains("Restarting")); assert!(stdout_lines.next().unwrap().contains("42")); wait_for_process_finished("Process", &mut stderr_lines); @@ -1545,7 +1513,7 @@ fn run_watch() { // Confirm that the watcher keeps on working even if the file is updated and has invalid syntax std::fs::write(&file_to_watch, "syntax error ^^") .expect("error writing file"); - std::thread::sleep(TIMEOUT); + std::thread::sleep(std::time::Duration::from_secs(1)); assert!(stderr_lines.next().unwrap().contains("Restarting")); assert!(stderr_lines.next().unwrap().contains("error:")); wait_for_process_finished("Process", &mut stderr_lines); @@ -1556,7 +1524,7 @@ fn run_watch() { "import { foo } from './another_file.js'; console.log(foo);", ) .expect("error writing file"); - std::thread::sleep(TIMEOUT); + std::thread::sleep(std::time::Duration::from_secs(1)); assert!(stderr_lines.next().unwrap().contains("Restarting")); assert!(stdout_lines.next().unwrap().contains("42")); wait_for_process_finished("Process", &mut stderr_lines); @@ -1570,16 +1538,8 @@ fn run_watch() { /// Confirm that the watcher continues to work even if module resolution fails at the *first* attempt #[test] +#[ignore] fn run_watch_not_exit() { - const TIMEOUT: std::time::Duration = - // Increase timeout duration to address flakiness on CI as much as possible - // See https://github.com/denoland/deno/issues/8571 - std::time::Duration::from_secs(if cfg!(target_os = "macos") { - 5 - } else { - 1 - }); - let t = TempDir::new().expect("tempdir fail"); let file_to_watch = t.path().join("file_to_watch.js"); std::fs::write(&file_to_watch, "syntax error ^^") @@ -1604,14 +1564,14 @@ fn run_watch_not_exit() { let mut stderr_lines = std::io::BufReader::new(stderr).lines().map(|r| r.unwrap()); - std::thread::sleep(TIMEOUT); + std::thread::sleep(std::time::Duration::from_secs(1)); assert!(stderr_lines.next().unwrap().contains("error:")); assert!(stderr_lines.next().unwrap().contains("Process failed!")); // Make sure the watcher actually restarts and works fine with the proper syntax std::fs::write(&file_to_watch, "console.log(42);") .expect("error writing file"); - std::thread::sleep(TIMEOUT); + std::thread::sleep(std::time::Duration::from_secs(1)); assert!(stderr_lines.next().unwrap().contains("Restarting")); assert!(stdout_lines.next().unwrap().contains("42")); wait_for_process_finished("Process", &mut stderr_lines); @@ -1697,6 +1657,7 @@ fn repl_test_pty_unpaired_braces() { } #[test] +#[ignore] fn run_watch_with_importmap_and_relative_paths() { fn create_relative_tmp_file( directory: &TempDir, @@ -1712,16 +1673,6 @@ fn run_watch_with_importmap_and_relative_paths() { assert!(relative_path.is_relative()); relative_path } - - const TIMEOUT: std::time::Duration = - // Increase timeout duration to address flakiness on CI as much as possible - // See https://github.com/denoland/deno/issues/8571 - std::time::Duration::from_secs(if cfg!(target_os = "macos") { - 5 - } else { - 1 - }); - let temp_directory = TempDir::new_in(util::root_path()).expect("tempdir fail"); let file_to_watch = create_relative_tmp_file( @@ -1756,8 +1707,6 @@ fn run_watch_with_importmap_and_relative_paths() { let mut stderr_lines = std::io::BufReader::new(stderr).lines().map(|r| r.unwrap()); - std::thread::sleep(TIMEOUT); - assert!(stderr_lines.next().unwrap().contains("Process finished")); assert!(stdout_lines.next().unwrap().contains("Hello world")); |