Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
Signed-off-by: nikpivkin <nikita.pivkin@smartforce.io>
  • 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.