Skip to content

Commit

Permalink
add test for required fields on builtin checks (#965)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorvezani authored Jun 21, 2023
1 parent 0a26f3f commit 4b1d663
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
3 changes: 1 addition & 2 deletions pkg/config/checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
var (
// BuiltInChecks contains the checks that come pre-installed w/ Polaris
BuiltInChecks = map[string]SchemaCheck{}
schemaBox = (*packr.Box)(nil)
// We explicitly set the order to avoid thrash in the
// tests as we migrate toward JSON schema
checkOrder = []string{
Expand Down Expand Up @@ -72,7 +71,7 @@ var (
)

func init() {
schemaBox = packr.New("Schemas", "../../checks")
schemaBox := packr.New("Schemas", "../../checks")
for _, checkID := range checkOrder {
contents, err := schemaBox.Find(checkID + ".yaml")
if err != nil {
Expand Down
16 changes: 16 additions & 0 deletions pkg/config/checks_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package config

import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestRequiredFieldsOnBuiltInChecks(t *testing.T) {
for _, v := range BuiltInChecks {
assert.NotEmpty(t, v.SuccessMessage)
assert.NotEmpty(t, v.FailureMessage)
assert.NotEmpty(t, v.Category)
assert.NotEmpty(t, v.Target)
}
}

0 comments on commit 4b1d663

Please sign in to comment.