fix(volume/prune): document and test label! filter support#7052
Open
mohithshuka wants to merge 1 commit into
Open
fix(volume/prune): document and test label! filter support#7052mohithshuka wants to merge 1 commit into
mohithshuka wants to merge 1 commit into
Conversation
The --filter flag description for 'docker volume prune' only mentioned 'label=<label>' but not 'label!=<label>', even though the label! filter is supported and handled correctly by the underlying PruneFilters function. This commit: - Updates the --filter flag description to include label!=<label> - Adds a unit test for the label! filter to match the existing label filter test Fixes docker#6918 Signed-off-by: mohithshuka <YOUR_ID+mohithshuka@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds coverage and CLI help text for using a negated label filter (label!=...) with volume prune, including new golden output for the interactive confirmation flow.
Changes:
- Add a new
label!=...filter test case forvolume prune. - Add a new golden file for the
label-not-filtertest output. - Update
volume prune --filterhelp text to mentionlabel!=<label>.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| cli/command/volume/testdata/volume-prune-success.label-not-filter.golden | Adds golden output for the new label!= filter test scenario. |
| cli/command/volume/prune_test.go | Introduces a new test case asserting label!=foobar is parsed into the expected filters structure. |
| cli/command/volume/prune.go | Updates --filter help text to document label!=<label> usage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+105
to
+106
| name: "label-not-filter", | ||
| args: []string{"--filter", "label!=foobar"}, |
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.
What does this PR do?
The
--filterflag description fordocker volume pruneonly mentionedlabel=<label>but notlabel!=<label>, making it inconsistent withdocker system prunewhich documents both forms.The
label!filter already works correctly via the sharedPruneFiltersfunction — it was just undocumented and untested at the volume prune level.
Changes
--filterflag description to includelabel!=<label>examplelabel!filter to match the existinglabelfilter testHow to test
Fixes #6918