Skip to content

test(core): wait out ETXTBSY before running the fake container CLI - #2522

Merged
vieiralucas merged 1 commit into
mainfrom
fix/core-fake-cli-etxtbsy
Sep 14, 2026
Merged

vieiralucas merged 1 commit into
mainfrom
fix/core-fake-cli-etxtbsy

Conversation

@vieiralucas

@vieiralucas vieiralucas commented Sep 13, 2026 •

Copy link
Copy Markdown
Member

Summary

container_image::tests::a_missing_image_fails_without_retrying failed in CI on #2521 with:

left:  Err("/tmp/.tmpcxArB6/cli pull: Text file busy (os error 26)")
right: Err("Error response from daemon: manifest for alpine:nope not found: manifest unknown")

The FakeCli fixture added in #2516 writes a shell script and then executes it. Tests run on parallel threads. A child process forked by another test while fs::write still had the script open inherits that write descriptor, and holds it until the child calls exec. If our test executes the script in that window, it fails with ETXTBSY. It's a race in the test fixture; the production pull code is fine.

Change

Right after writing the script, FakeCli::new runs it once and retries (5ms apart, up to 1s) while that fails with ErrorKind::ExecutableFileBusy. Once one run succeeds, no process can hold a writable descriptor to the script again, so the real calls can't hit the race. The probe's line in calls.log is removed so call assertions are unchanged.

Test plan

  • cargo test -p fakecloud-core container_image: 17 pass
  • cargo clippy -p fakecloud-core --all-targets -- -D warnings: clean

No non-code surface affected.


Summary by cubic

Fixes a flaky failure in the fake container CLI test fixture where a test could fail with Text file busy (os error 26) when another parallel test's child process still held the script open for writing.

FakeCli::new now runs the script once right after writing it, retrying while it gets ExecutableFileBusy, guaranteeing no process can later hold a writable descriptor. The probe run's line is removed from calls.log so call assertions are unchanged.

Written for commit dbe6565. Summary will update on new commits.

Review in cubic

FakeCli writes a shell script and then executes it. Tests run on
parallel threads, and a child forked by another test while fs::write had
the script open inherits that write descriptor until it execs; executing
the script in that window fails with 'Text file busy (os error 26)'.
Seen as a CI failure of a_missing_image_fails_without_retrying.

Run the script once right after writing it, retrying while it reports
ExecutableFileBusy. Once that succeeds nothing can hold a writable
descriptor to it again.
@vieiralucas
vieiralucas merged commit 3daf596 into main Sep 14, 2026
156 of 157 checks passed
@vieiralucas
vieiralucas deleted the fix/core-fake-cli-etxtbsy branch September 14, 2026 02:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant