diff options
author | Martin Polden <mpolden@mpolden.no> | 2022-02-02 09:47:08 +0100 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2022-02-02 09:47:08 +0100 |
commit | 02298d5f65e53a36ce94fd0febcf5e6e16996756 (patch) | |
tree | 1849693a52470c7654c1365dd20d98997dd3a3a8 /client | |
parent | b754deecd3cd7856f7c407dbab479e950316a9ab (diff) |
Strip spaces from node count range
Diffstat (limited to 'client')
-rw-r--r-- | client/go/vespa/xml/config.go | 4 | ||||
-rw-r--r-- | client/go/vespa/xml/config_test.go | 1 |
2 files changed, 3 insertions, 2 deletions
diff --git a/client/go/vespa/xml/config.go b/client/go/vespa/xml/config.go index e900b50cbb0..5c74bb797d3 100644 --- a/client/go/vespa/xml/config.go +++ b/client/go/vespa/xml/config.go @@ -180,11 +180,11 @@ func ParseNodeCount(s string) (int, int, error) { if len(parts) != 2 { return 0, 0, parseErr } - min, err := strconv.Atoi(parts[0]) + min, err := strconv.Atoi(strings.TrimSpace(parts[0])) if err != nil { return 0, 0, parseErr } - max, err := strconv.Atoi(parts[1]) + max, err := strconv.Atoi(strings.TrimSpace(parts[1])) if err != nil { return 0, 0, parseErr } diff --git a/client/go/vespa/xml/config_test.go b/client/go/vespa/xml/config_test.go index 9d18636473b..4cee1af435f 100644 --- a/client/go/vespa/xml/config_test.go +++ b/client/go/vespa/xml/config_test.go @@ -252,6 +252,7 @@ func TestParseResources(t *testing.T) { func TestParseNodeCount(t *testing.T) { assertNodeCount(t, "2", 2, 2, false) assertNodeCount(t, "[4,8]", 4, 8, false) + assertNodeCount(t, "[ 4, 8 ]", 4, 8, false) assertNodeCount(t, "foo", 0, 0, true) assertNodeCount(t, "[foo,bar]", 0, 0, true) |