Draft
Conversation
9258465 to
ddfdf97
Compare
There was a problem hiding this comment.
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
-Purgelogic 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-Moduleand 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
$TestDrivevariable. 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
-purgeflag is passed.Additionl tasks:
$TestDriveinstead 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: