Skip to content

Commit

Permalink
c/clientutil: test using empty keys in ParseConfigValues
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewphelpsj committed Jan 21, 2025
1 parent dd70eaa commit 0b0767e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions client/clientutil/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,14 @@ func (s *parseSuite) TestParseConfigValues(c *C) {
})
c.Assert(keys, DeepEquals, []string{"foo"})
}

func (s *parseSuite) TestParseConfigValuesEmptyKey(c *C) {
_, _, err := clientutil.ParseConfigValues([]string{""}, nil)
c.Assert(err, ErrorMatches, `invalid configuration: "" \(want key=value\)`)

_, _, err = clientutil.ParseConfigValues([]string{"=value"}, nil)
c.Assert(err, ErrorMatches, `configuration keys cannot be empty`)

_, _, err = clientutil.ParseConfigValues([]string{"!"}, nil)
c.Assert(err, ErrorMatches, `configuration keys cannot be empty`)
}

0 comments on commit 0b0767e

Please sign in to comment.