Sort swarm stacks and nodes using natural sorting#315
Sort swarm stacks and nodes using natural sorting#315thaJeztah merged 1 commit intodocker:masterfrom boaz0:nat_sort
Conversation
|
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 |
|
|
||
| func TestNodeListOrder(t *testing.T) { | ||
| buf := new(bytes.Buffer) | ||
| cli := test.NewFakeCli(&fakeClient{ |
There was a problem hiding this comment.
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 |
|
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.goandcli/command/stack/list.go- How to verify it
Run unit-tests