Skip to content

Commit

Permalink
[exporter/bmchelix] New component: BMC Helix Exporter
Browse files Browse the repository at this point in the history
* Fixed timeout positive integer check.
  • Loading branch information
NassimBtk committed Dec 26, 2024
1 parent 02c1d33 commit 9910f82
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion exporter/bmchelixexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (c *Config) Validate() error {
if c.ApiKey == "" {
return errors.New("api key is required")
}
if c.Timeout < 0 {
if c.Timeout <= 0 {
return errors.New("timeout must be a positive integer")
}

Expand Down
9 changes: 9 additions & 0 deletions exporter/bmchelixexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@ func TestValidateConfig(t *testing.T) {
},
err: "timeout must be a positive integer",
},
{
name: "invalid_config4",
config: &Config{
Endpoint: "https://helix:8080",
ApiKey: "api_key",
Timeout: 0,
},
err: "timeout must be a positive integer",
},
}

for _, tt := range tests {
Expand Down

0 comments on commit 9910f82

Please sign in to comment.