-
Notifications
You must be signed in to change notification settings - Fork 10
Fix uninstall command premature exit #77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
9258465
to
ddfdf97
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR ensures uninstall routines no longer exit prematurely on empty directories and properly quotes executable paths for command invocations. It also refactors HNS module import logic and updates unit tests to mock the new patterns.
- Allow
-Purge
logic to run even when no binaries are found by removing early exit checks. - Locate and quote executable paths (
nerdctl.exe
,containerd.exe
,buildkitd.exe
) before invoking commands. - Refactor HNS import to use
Get-Module
and pipeline import, and adjust related tests.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
containers-toolkit/Public/NerdctlTools.psm1 | Removed empty‐dir guard, added executable lookup and pruning flags |
containers-toolkit/Public/ContainerdTools.psm1 | Removed early exit, quoted executable paths, updated uninstall helper |
containers-toolkit/Public/ContainerNetworkTools.psm1 | Refactored HNS import via Get-Module pipeline |
containers-toolkit/Public/BuildkitTools.psm1 | Quoted commands, replaced service setup warning message |
Tests/NerdctlTools.Tests.ps1 | Mocked executable lookup, updated prune argument |
Tests/ContainerNetworkTools.Tests.ps1 | Adjusted expectations around Get-Module and Import-Module |
Tests/BuildkitTools.Tests.ps1 | Introduced CleanupTestDrive , cleaned up duplicated paths |
Comments suppressed due to low confidence (2)
containers-toolkit/Public/BuildkitTools.psm1:143
- [nitpick] Use "set up" (verb) instead of "setup" for verb usage: e.g., "Failed to set up Buildkitd service. $_".
Write-Warning "Failed to setup Buildkitd service. $_"
Tests/BuildkitTools.Tests.ps1:35
- The hard-coded path "TestDrive:\" duplicates the
$TestDrive
variable. Consider using"$TestDrive"
consistently to avoid path mismatches and simplify cleanup logic.
Get-ChildItem -Path "TestDrive:\\" -Recurse -Force -ErrorAction SilentlyContinue | `
dc11c78
to
b077887
Compare
b077887
to
2fbc4c7
Compare
PR Description
This PR ensures uninstall routines no longer exit prematurely on empty directories.
Current implementation:
containers-toolkit/containers-toolkit/Public/ContainerdTools.psm1
Lines 334 to 337 in 216fb37
This causes the command to exit prematurely, even when the
-purge
flag is passed.Additionl tasks:
$TestDrive
instead ofTestDtivr:\
in Buildkit TestsChecklist
As part of our commitment to engineering excellence, before submitting this PR, please ensure:
In addition, after this PR has been reviewed, please ensure: