Unverified Commit 3a6dc245 authored by Tobias Koppers's avatar Tobias Koppers Committed by GitHub

Ignore flaky turbo-tasks-fs watcher tests in CI (#100627)

### What?

Ignores four timing-sensitive `turbo-tasks-fs` watcher tests in GitHub
Actions while keeping them enabled for local runs:

- `irrelevant_events_do_not_delay_invalidation`
- `repeated_writes_to_tracked_file_are_debounced`
- `recreated_directory_is_watched_again`
- `read_registered_before_watch_is_restored_is_invalidated`

### Why?

These watcher tests depend on filesystem-event and debounce timing,
which is unreliable on CI runners and causes flaky failures.

### How?

- `turbo-tasks-fs` gets an opt-in `ci` cargo feature. Each of the four
tests is ignored only when that feature is enabled. The attribute is
placed after the rstest cases so it applies to every generated case (14
in total).
- A dedicated `test-cargo-unit-ci` script and Turbo task enable
`turbo-tasks-fs/ci` for the nextest and doctest commands. A separate
script is needed because extra Turbo args are appended only to the final
command in the existing `&&` chain.
- The `test-cargo-unit` GitHub Actions job now runs
`test-cargo-unit-ci`. The existing local `test-cargo-unit` command is
unchanged and still runs these tests.

### Verification

- `cargo test -p turbo-tasks-fs --lib --features turbo-tasks-fs/ci --
watcher::tests`: 6 passed, 14 ignored
- `cargo test -p turbo-tasks-fs --lib -- watcher::tests`: 20 passed, 0
ignored
- Compared `cargo nextest list` JSON output with and without the
feature: exactly the 14 targeted cases change ignore status.
- Turbo dry run resolves `@next/swc#test-cargo-unit-ci` to the
feature-enabled commands.

<!-- NEXT_JS_LLM -->


<!-- fleet 3dc2faec-b6b1-43eb-ae2d-4951789fb457 -->
Co-authored-by: 's avatarvercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com>
Co-authored-by: 's avatarTobias Koppers <1365881+sokra@users.noreply.github.com>
parent faa474c4
...@@ -314,7 +314,8 @@ jobs: ...@@ -314,7 +314,8 @@ jobs:
needsRustJsInstall: 'yes' needsRustJsInstall: 'yes'
skipNativeBuild: 'yes' skipNativeBuild: 'yes'
skipInstallBuild: 'yes' skipInstallBuild: 'yes'
afterBuild: pnpm dlx turbo@${TURBO_VERSION} run test-cargo-unit ${TURBO_ARGS} # `test-cargo-unit-ci` enables the `ci` cargo features, which ignore tests that are flaky on CI runners.
afterBuild: pnpm dlx turbo@${TURBO_VERSION} run test-cargo-unit-ci ${TURBO_ARGS}
stepName: 'test-cargo-unit' stepName: 'test-cargo-unit'
# Run on x86-64 instead of arm64/aarch64. The pnpm workspace in # Run on x86-64 instead of arm64/aarch64. The pnpm workspace in
# turbopack/crates/turbopack-tracing/tests/node-file-trace pulls in a ton # turbopack/crates/turbopack-tracing/tests/node-file-trace pulls in a ton
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
"rust-check-fmt": "cd ../..; cargo fmt -- --check", "rust-check-fmt": "cd ../..; cargo fmt -- --check",
"rust-check-napi": "cargo check -p next-napi-bindings", "rust-check-napi": "cargo check -p next-napi-bindings",
"test-cargo-unit": "cargo nextest run --workspace --exclude next-napi-bindings --exclude turbo-tasks-macros --cargo-profile release-with-assertions --no-fail-fast && cargo test --workspace --doc --profile=release-with-assertions --no-fail-fast", "test-cargo-unit": "cargo nextest run --workspace --exclude next-napi-bindings --exclude turbo-tasks-macros --cargo-profile release-with-assertions --no-fail-fast && cargo test --workspace --doc --profile=release-with-assertions --no-fail-fast",
"test-cargo-unit-ci": "cargo nextest run --workspace --exclude next-napi-bindings --exclude turbo-tasks-macros --features turbo-tasks-fs/ci --cargo-profile release-with-assertions --no-fail-fast && cargo test --workspace --doc --features turbo-tasks-fs/ci --profile=release-with-assertions --no-fail-fast",
"test-cargo-unit-miri": "MIRIFLAGS='-Zmiri-disable-isolation -Zmiri-permissive-provenance' cargo miri nextest run -p turbo-persistence -p turbo-rcstr -p turbo-tasks-malloc --no-default-features --features turbo-tasks-malloc/custom_allocator --no-fail-fast" "test-cargo-unit-miri": "MIRIFLAGS='-Zmiri-disable-isolation -Zmiri-permissive-provenance' cargo miri nextest run -p turbo-persistence -p turbo-rcstr -p turbo-tasks-malloc --no-default-features --features turbo-tasks-malloc/custom_allocator --no-fail-fast"
}, },
"napi": { "napi": {
......
...@@ -91,6 +91,16 @@ ...@@ -91,6 +91,16 @@
"!../../turbopack/crates/turbopack-tests/tests/execution/**/output/*", "!../../turbopack/crates/turbopack-tests/tests/execution/**/output/*",
], ],
}, },
// Same as `test-cargo-unit`, but with the `ci` features that ignore tests known to be flaky on CI runners.
"test-cargo-unit-ci": {
"dependsOn": ["rust-fingerprint"],
"inputs": [
"../../target/.rust-fingerprint",
"../../crates/*/tests/**",
"../../turbopack/crates/*/tests/**",
"!../../turbopack/crates/turbopack-tests/tests/execution/**/output/*",
],
},
"test-cargo-unit-miri": { "test-cargo-unit-miri": {
"dependsOn": ["rust-fingerprint"], "dependsOn": ["rust-fingerprint"],
"inputs": [ "inputs": [
......
...@@ -18,6 +18,8 @@ default = [] ...@@ -18,6 +18,8 @@ default = []
# A binary built with this option **is not portable**, the directory # A binary built with this option **is not portable**, the directory
# path will be embedded into the binary. # path will be embedded into the binary.
dynamic_embed_contents = [] dynamic_embed_contents = []
# Set in CI to ignore timing-sensitive watcher tests that are flaky on CI runners.
ci = []
[lints] [lints]
workspace = true workspace = true
......
...@@ -1428,6 +1428,7 @@ mod tests { ...@@ -1428,6 +1428,7 @@ mod tests {
Some(Duration::from_millis(20)), Some(Duration::from_millis(20)),
DiskWatcherRecursiveMode::NonRecursive DiskWatcherRecursiveMode::NonRecursive
)] )]
#[cfg_attr(feature = "ci", ignore = "timing-sensitive, flaky in CI")]
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn irrelevant_events_do_not_delay_invalidation( async fn irrelevant_events_do_not_delay_invalidation(
#[case] poll_interval: Option<Duration>, #[case] poll_interval: Option<Duration>,
...@@ -1502,6 +1503,7 @@ mod tests { ...@@ -1502,6 +1503,7 @@ mod tests {
Some(Duration::from_millis(20)), Some(Duration::from_millis(20)),
DiskWatcherRecursiveMode::NonRecursive DiskWatcherRecursiveMode::NonRecursive
)] )]
#[cfg_attr(feature = "ci", ignore = "timing-sensitive, flaky in CI")]
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn repeated_writes_to_tracked_file_are_debounced( async fn repeated_writes_to_tracked_file_are_debounced(
#[case] poll_interval: Option<Duration>, #[case] poll_interval: Option<Duration>,
...@@ -1583,6 +1585,7 @@ mod tests { ...@@ -1583,6 +1585,7 @@ mod tests {
#[case::non_recursive_rename(DiskWatcherRecursiveMode::NonRecursive, true)] #[case::non_recursive_rename(DiskWatcherRecursiveMode::NonRecursive, true)]
#[case::recursive_create(DiskWatcherRecursiveMode::Recursive, false)] #[case::recursive_create(DiskWatcherRecursiveMode::Recursive, false)]
#[case::recursive_rename(DiskWatcherRecursiveMode::Recursive, true)] #[case::recursive_rename(DiskWatcherRecursiveMode::Recursive, true)]
#[cfg_attr(feature = "ci", ignore = "timing-sensitive, flaky in CI")]
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn recreated_directory_is_watched_again( async fn recreated_directory_is_watched_again(
#[case] recursive_mode: DiskWatcherRecursiveMode, #[case] recursive_mode: DiskWatcherRecursiveMode,
...@@ -1656,6 +1659,7 @@ mod tests { ...@@ -1656,6 +1659,7 @@ mod tests {
#[rstest] #[rstest]
#[case::non_recursive(DiskWatcherRecursiveMode::NonRecursive)] #[case::non_recursive(DiskWatcherRecursiveMode::NonRecursive)]
#[case::recursive(DiskWatcherRecursiveMode::Recursive)] #[case::recursive(DiskWatcherRecursiveMode::Recursive)]
#[cfg_attr(feature = "ci", ignore = "timing-sensitive, flaky in CI")]
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn read_registered_before_watch_is_restored_is_invalidated( async fn read_registered_before_watch_is_restored_is_invalidated(
#[case] recursive_mode: DiskWatcherRecursiveMode, #[case] recursive_mode: DiskWatcherRecursiveMode,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment