Skip to content

Commit

Permalink
cli: ensure scaling policy target doesn't have trailing comma
Browse files Browse the repository at this point in the history
  • Loading branch information
jrasell committed Oct 6, 2020
1 parent 13466a9 commit 53b240b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion command/scaling_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,5 @@ func formatScalingPolicyTarget(t map[string]string) string {
if len(other) > 0 {
out = append(out, other...)
}
return strings.Join(out, ",")
return strings.Trim(strings.Join(out, ","), ",")
}
7 changes: 7 additions & 0 deletions command/scaling_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ func Test_formatScalingPolicyTarget(t *testing.T) {
expectedOutput: "Namespace:default,Job:example,Group:cache,Unknown:alien",
name: "extra key in input mapping",
},
{
inputMap: map[string]string{
"Namespace": "default",
},
expectedOutput: "Namespace:default",
name: "single entry in map",
},
}

for _, tc := range testCases {
Expand Down

0 comments on commit 53b240b

Please sign in to comment.