Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a cleanup_docker_mounts function within the run_in_docker routine to resolve permission issues when deleting Docker-mounted directories. The reviewer suggests implementing a trap to ensure that cleanup is performed even if the script is interrupted by signals like SIGINT, preventing leftover root-owned directories.
Greptile SummaryThis PR fixes a race condition in Docker-based e2e tests where root-owned files created inside the container could not be removed by the host runner after the container exited, causing cleanup errors to mask a passing test status under
Confidence Score: 5/5Safe to merge — the change is a one-function, two-branch fix to a shell cleanup helper with no risk to test logic or production code. The change is minimal and targeted: a single conditional added to remove_isolated_env that switches between synchronous and background cleanup based on a well-scoped environment variable. The fix correctly addresses the root cause — files created inside Docker as root need to be cleaned up from within the container before it exits, otherwise the host runner cannot remove them under set -e. All other code paths are unaffected. No files require special attention. Reviews (2): Last reviewed commit: "test(e2e): wait for docker env cleanup" | Re-trigger Greptile |
9bf372b to
40221f8
Compare
|
CI note: The aggregate This comment was generated by an AI coding assistant. |
Summary
Context
#9570 changed Docker e2e runs to bind-mount host-backed directories for
/tmpand/rootinstead of using tmpfs. Inside the container,mktemp -dcreates root-owned0700per-test directories under the bind-mounted/tmp.For successful tests,
e2e/run_testpreviously startedrm -rf "$TEST_ISOLATED_DIR"in the background. When the Docker container exits before that background cleanup reliably finishes, root-owned0700test directories can be left behind on the host mount. The outer host-side cleanup then emits permission noise such asrm: cannot remove.Waiting for
rm -rfonly whenMISE_E2E_INSIDE_DOCKER=1fixes the source of that host-side cleanup noise without running a second container or broadly chmodding both mounts.Failed tests keep the existing behavior: the isolated test environment is left in place and reported for inspection, and the returned test status remains unchanged.
Tests
git diff --checkbash -n e2e/run_testmise x shellcheck -- shellcheck -x e2e/run_testmise x shfmt -- shfmt -d e2e/run_testMISE_E2E_DOCKER=1 E2E_WAIT_FOR_GH_RATE_LIMIT=0 mise run test:e2e e2e/cli/test_versionrm: cannot removelines