Skip to content

Commit

Permalink
Add a test case for saxutil getacl model all.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 691179379
Change-Id: I5832379bd8cbff1ca61a0a38d149cce131774676
  • Loading branch information
Sax Authors authored and copybara-github committed Oct 29, 2024
1 parent 1f37727 commit 8dd7698
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions saxml/bin/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ go_library(
"//saxml/common/platform:env",
"//saxml/protobuf:admin_go_proto_grpc",
"//saxml/protobuf:common_go_proto",
"//third_party/golang/go_exp/maps",
"@com_github_golang_glog//:go_default_library",
"@com_github_google_subcommands//:go_default_library",
"@com_github_olekukonko_tablewriter//:go_default_library",
Expand Down
9 changes: 7 additions & 2 deletions saxml/bin/saxutil_cmd_admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ import (
"math/rand"
"os"
"path/filepath"
"slices"
"sort"
"strconv"
"strings"

"flag"
log "github.com/golang/glog"
// Internal storage imports
"google3/third_party/golang/go_exp/maps/maps"
"google.golang.org/protobuf/proto"
"github.com/google/subcommands"
"github.com/olekukonko/tablewriter"
Expand Down Expand Up @@ -731,8 +733,11 @@ func (c *GetACLCmd) handleSaxModel(ctx context.Context, modelFullName naming.Mod
}
method := args[1]
if method == "all" {
for k, v := range items {
fmt.Printf("%s: %s\n", k, v)
// Sort the keys of the map.
keys := maps.Keys(items)
slices.Sort(keys)
for _, k := range keys {
fmt.Printf("%s: %s\n", k, items[k])
}
} else {
acl, ok := items[method]
Expand Down

0 comments on commit 8dd7698

Please sign in to comment.