Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
Signed-off-by: nikpivkin <[email protected]>
  • Loading branch information
nikpivkin committed Sep 26, 2024
1 parent 74c9297 commit 7246de4
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions pkg/iac/rego/scanner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"testing"
"testing/fstest"

"github.com/aquasecurity/trivy/pkg/iac/scanners/options"
"github.com/liamg/memoryfs"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -1223,18 +1222,11 @@ deny {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {

opts := []options.ScannerOption{
rego.WithPolicyReader(strings.NewReader(tt.inputCheck)),
rego.WithDisabledCheckIDs(tt.disabledChecks...),
}

if tt.inputCheck != "" {
opts = append(opts, rego.WithPolicyNamespaces("user"))
}

scanner := rego.NewScanner(
types.SourceYAML,
opts...,
rego.WithPolicyReader(strings.NewReader(tt.inputCheck)),
rego.WithDisabledCheckIDs(tt.disabledChecks...),
rego.WithPolicyNamespaces("user"),
)

require.NoError(t, scanner.LoadPolicies(nil))
Expand Down

0 comments on commit 7246de4

Please sign in to comment.