Skip to content

Commit

Permalink
fix: Make kube-hunter.quick config param optional (#388)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlevesquedion committed Feb 12, 2021
1 parent d3a3b00 commit 6b273d8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions pkg/starboard/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,9 @@ func (c ConfigData) GetKubeHunterImageRef() (string, error) {
}

func (c ConfigData) GetKubeHunterQuick() (bool, error) {
val, err := c.getRequiredProperty("kube-hunter.quick")
if err != nil {
return false, err
val, ok := c["kube-hunter.quick"]
if !ok {
return false, nil
}
if val != "false" && val != "true" {
return false, fmt.Errorf("property kube-hunter.quick must be either \"false\" or \"true\", got %q", val)
Expand Down
6 changes: 3 additions & 3 deletions pkg/starboard/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,11 @@ func TestConfigData_GetKubeHunterQuick(t *testing.T) {
expectedQuick bool
}{
{
name: "Should return error",
name: "Should return false when parameter is not set",
configData: starboard.ConfigData{},
expectedError: "property kube-hunter.quick not set",
expectedQuick: false,
}, {
name: "Should return error when when quick is set to something other than \"false\" or \"true\" in config data",
name: "Should return error when quick is set to something other than \"false\" or \"true\" in config data",
configData: starboard.ConfigData{
"kube-hunter.quick": "not-a-boolean",
},
Expand Down

0 comments on commit 6b273d8

Please sign in to comment.