diff --git a/test/rego/oracle_test.go b/test/rego/oracle_test.go new file mode 100644 index 00000000..17dfcee5 --- /dev/null +++ b/test/rego/oracle_test.go @@ -0,0 +1,36 @@ +package test + +import ( + "github.com/aquasecurity/trivy/pkg/iac/providers/oracle" + "github.com/aquasecurity/trivy/pkg/iac/state" + trivyTypes "github.com/aquasecurity/trivy/pkg/iac/types" +) + +var oracleTestCases = testCases{ + "AVD-OCI-0001": { + { + name: "Compute instance public reservation pool", + input: state.State{Oracle: oracle.Oracle{Compute: oracle.Compute{ + AddressReservations: []oracle.AddressReservation{ + { + Metadata: trivyTypes.NewTestMetadata(), + Pool: trivyTypes.String("public-ippool", trivyTypes.NewTestMetadata()), + }, + }, + }}}, + expected: true, + }, + { + name: "Compute instance cloud reservation pool", + input: state.State{Oracle: oracle.Oracle{Compute: oracle.Compute{ + AddressReservations: []oracle.AddressReservation{ + { + Metadata: trivyTypes.NewTestMetadata(), + Pool: trivyTypes.String("cloud-ippool", trivyTypes.NewTestMetadata()), + }, + }, + }}}, + expected: false, + }, + }, +} diff --git a/test/rego/rego_checks_test.go b/test/rego/rego_checks_test.go index f01e2613..3b5f9d34 100644 --- a/test/rego/rego_checks_test.go +++ b/test/rego/rego_checks_test.go @@ -62,15 +62,17 @@ func TestRegoChecks(t *testing.T) { azureAuthorizationTestCases, azureContainerTestCases, - googleDnsTestCases, + googleDnsTestCases, googleKmsTestCases, googleBigQueryTestCases, - githubTestCases, + githubTestCases, - nifcloudDnsTestCases, + nifcloudDnsTestCases, nifcloudNetworkTestCases, nifcloudSslCertificateTestCases, + + oracleTestCases, ) regoScanner := rego.NewScanner(trivyTypes.SourceCloud)