Skip to content

Flaky on Windows: Cargo fixture cleanup in rust-adapter.test.ts fails with EPERM #227

Closed

Description

@FredApps

Cargo feature-unified unit tests are recorded per crate instead of blocking the repository (tests/repo/rust-adapter.test.ts:440) fails now and then on Windows. It isn't the assertion that fails but the cleanup:

✖ Cargo feature-unified unit tests are recorded per crate instead of blocking the repository (60233.6101ms)
  Error: EPERM, Permission denied: 'C:\Users\RUNNER~1\AppData\Local\Temp\diffci-rust-sbPbAQ'
      at rmSync (node:fs:1282:18)
      at TestContext.<anonymous> (D:\a\core\core\tests\repo\rust-adapter.test.ts:455:15)

This was seen on #174, in check (windows-latest, 24) (job). The Node 22 Windows job passed on the same commit. The test runs cargo test -- --list, which builds and runs test executables inside the fixture's target/. On Windows, the image (or an antivirus scan of a just-written .exe) can stay locked briefly after the process exits, so a single rmSync gets EPERM.

Fix: remove Cargo-built fixtures with rmSync(root, { recursive: true, force: true, maxRetries: 10, retryDelay: 200 }). Node retries EPERM/EBUSY/ENOTEMPTY with a linear backoff, as rimraf does. Apply the same to the other real-Cargo tests in the file, which build into their fixture too.

Activity

  1. FredApps commented on Nov 17, 2026

    @FredApps
    ContributorAuthor

    The same thing just happened outside the Rust tests: on #233, check (windows-latest, 24) failed in tests/repo/go-scope-local-replace.test.ts ("a change in a replaced in-repository module selects the root packages that import it") with EPERM, Permission denied: ...\Temp\diffci-go-replace-rbiv9M (job), after go had built in the fixture. #235 only covers the Rust tests. The Go and other tool-running fixtures probably want the same maxRetries/retryDelay cleanup, maybe through a shared test helper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions