-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Sort swarm stacks and nodes using natural sorting #315
Conversation
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.
LGTM
ping @aaronlehmann PTAL |
Actually, the description says this is being applied to service and node listing, but I see that the code changes are only in |
Well, yeah I know it might be misleading but when running |
cli/command/node/list_test.go
Outdated
|
||
func TestNodeListOrder(t *testing.T) { | ||
buf := new(bytes.Buffer) | ||
cli := test.NewFakeCli(&fakeClient{ |
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.
This function has changed on master. It no longer takes a second argument, but defaults to using a buffer.
You can access the buffer from cli.OutBuffer()
This commit changes the order stacks and nodes are displayed. For example, running "docker stack ls" is expected to display the following list: NAME SERVICES service-1 1 service-2 1 service-10 1 However, currently this is what is printed: NAME SERVICES service-1 1 service-10 1 service-2 1 To fix this, "docker stack ls" and "docker node ls" are using natural sorting to make it more human readable. Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #315 +/- ##
==========================================
+ Coverage 48.84% 48.87% +0.02%
==========================================
Files 186 186
Lines 12413 12418 +5
==========================================
+ Hits 6063 6069 +6
+ Misses 5976 5975 -1
Partials 374 374 |
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.
LGTM 🐯
Can we please get a followup PR to get |
Ooh sorry I didn't know that this is what you meant in your comment. |
follow up to moby/moby#31638
- What I did
Use natural sorting to display swarm stacks and nodes.
- How I did it
Import vbom.ml/util/sortorder and update Less(i, j int) bool in both
cli/command/node/list.go
andcli/command/stack/list.go
- How to verify it
Run unit-tests