github.com/aquasecurity/trivy-iac@v0.8.1-0.20240127024015-3d8e412cf0ab/test/fs_test.go (about)

     1  package test
     2  
     3  import (
     4  	"context"
     5  	"os"
     6  	"testing"
     7  
     8  	"github.com/aquasecurity/defsec/pkg/scanners/options"
     9  	"github.com/stretchr/testify/assert"
    10  	"github.com/stretchr/testify/require"
    11  
    12  	"github.com/aquasecurity/trivy-iac/pkg/scanners/terraform"
    13  )
    14  
    15  func Test_OS_FS(t *testing.T) {
    16  	s := terraform.New(
    17  		options.ScannerWithDebug(os.Stderr),
    18  		options.ScannerWithEmbeddedPolicies(true),
    19  		options.ScannerWithEmbeddedLibraries(true),
    20  	)
    21  	results, err := s.ScanFS(context.TODO(), os.DirFS("tf"), "fail")
    22  	require.NoError(t, err)
    23  	assert.Greater(t, len(results.GetFailed()), 0)
    24  }