Skip to content

Commit

Permalink
fix(server): sort the cluster list in ListClusters (#326)
Browse files Browse the repository at this point in the history
To have a consistent output.
  • Loading branch information
kkaneda authored Jan 4, 2025
1 parent 5b96239 commit b2bff0e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions server/internal/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"net"
"sort"
"strings"

"github.com/go-logr/logr"
Expand Down Expand Up @@ -190,6 +191,9 @@ func (s *S) ListClusters(ctx context.Context, req *v1.ListClustersRequest) (*v1.
Status: &st,
})
}
sort.Slice(cs, func(i, j int) bool {
return cs[i].Id < cs[j].Id
})

return &v1.ListClustersResponse{
Clusters: cs,
Expand Down

0 comments on commit b2bff0e

Please sign in to comment.