Skip to content
This repository has been archived by the owner on Oct 14, 2024. It is now read-only.

Commit

Permalink
feat(test): use any operator in scan scope
Browse files Browse the repository at this point in the history
  • Loading branch information
paralta committed Aug 16, 2023
1 parent e74a6c7 commit bdff0fc
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
2 changes: 1 addition & 1 deletion e2e/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
)

const (
DefaultScope string = "contains(assetInfo.labels, '{\"key\":\"scanconfig\",\"value\":\"test\"}')"
DefaultScope string = "assetInfo/labels/any(t: t/key eq 'scanconfig' and t/value eq 'test')"
DefaultTimeout time.Duration = 60 * time.Second
)

Expand Down
35 changes: 34 additions & 1 deletion pkg/apiserver/database/gorm/odata.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ var schemaMetas = map[string]odatasql.SchemaMeta{
"scansCount": odatasql.FieldMeta{FieldType: odatasql.PrimitiveFieldType},
"assetInfo": odatasql.FieldMeta{
FieldType: odatasql.ComplexFieldType,
ComplexFieldSchemas: []string{"VMInfo"},
ComplexFieldSchemas: []string{"VMInfo", "ContainerInfo", "ContainerImageInfo"},
DiscriminatorProperty: "objectType",
},
"summary": odatasql.FieldMeta{
Expand Down Expand Up @@ -498,6 +498,39 @@ var schemaMetas = map[string]odatasql.SchemaMeta{
"id": odatasql.FieldMeta{FieldType: odatasql.PrimitiveFieldType},
},
},
"ContainerImageInfo": {
Fields: odatasql.Schema{
"architecture": odatasql.FieldMeta{FieldType: odatasql.PrimitiveFieldType},
"id": odatasql.FieldMeta{FieldType: odatasql.PrimitiveFieldType},
"labels": odatasql.FieldMeta{
FieldType: odatasql.CollectionFieldType,
CollectionItemMeta: &odatasql.FieldMeta{
FieldType: odatasql.ComplexFieldType,
ComplexFieldSchemas: []string{"Tag"},
},
},
"name": odatasql.FieldMeta{FieldType: odatasql.PrimitiveFieldType},
"objectType": odatasql.FieldMeta{FieldType: odatasql.PrimitiveFieldType},
"os": odatasql.FieldMeta{FieldType: odatasql.PrimitiveFieldType},
"size": odatasql.FieldMeta{FieldType: odatasql.PrimitiveFieldType},
},
},
"ContainerInfo": {
Fields: odatasql.Schema{
"containerName": odatasql.FieldMeta{FieldType: odatasql.PrimitiveFieldType},
"createdAt": odatasql.FieldMeta{FieldType: odatasql.PrimitiveFieldType},
"id": odatasql.FieldMeta{FieldType: odatasql.PrimitiveFieldType},
"image": odatasql.FieldMeta{FieldType: odatasql.PrimitiveFieldType},
"labels": odatasql.FieldMeta{
FieldType: odatasql.CollectionFieldType,
CollectionItemMeta: &odatasql.FieldMeta{
FieldType: odatasql.ComplexFieldType,
ComplexFieldSchemas: []string{"Tag"},
},
},
"objectType": odatasql.FieldMeta{FieldType: odatasql.PrimitiveFieldType},
},
},
"ScanFindingsSummary": {
Fields: odatasql.Schema{
"totalPackages": odatasql.FieldMeta{FieldType: odatasql.PrimitiveFieldType},
Expand Down

0 comments on commit bdff0fc

Please sign in to comment.