FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
stackrox/tests/options_test.go at master · stackrox/stackrox · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
stackrox
/
stackrox
Public
Notifications
You must be signed in to change notification settings
Fork
191
Star
1.3k
Code
Issues
54
Pull requests
595
Actions
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
stackrox
/
tests
/
options_test.go
Copy path
More file actions
More file actions
Latest commit
History
History
History
80 lines (73 loc) · 3.21 KB
Breadcrumbs
stackrox
/
tests
/
options_test.go
Copy path
File metadata and controls
80 lines (73 loc) · 3.21 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//go:build test_e2e
package
tests
import
(
"context"
"fmt"
"testing"
"time"
"github.com/stackrox/rox/central/search"
"github.com/stackrox/rox/central/search/options"
v1
"github.com/stackrox/rox/generated/api/v1"
"github.com/stackrox/rox/pkg/testutils/centralgrpc"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func
TestOptionsMapExist
(
t
*
testing.
T
) {
conn
:=
centralgrpc
.
GRPCConnectionToCentral
(
t
)
service
:=
v1
.
NewSearchServiceClient
(
conn
)
for
_
,
categories
:=
range
[][]v1.
SearchCategory
{
{},
{
v1
.
SearchCategory_ALERTS
},
{
v1
.
SearchCategory_DEPLOYMENTS
},
{
v1
.
SearchCategory_IMAGES
},
{
v1
.
SearchCategory_POLICIES
},
search
.
GetGlobalSearchCategories
().
AsSlice
(),
} {
cat
:=
categories
t
.
Run
(
fmt
.
Sprintf
(
"%v"
,
categories
),
func
(
t
*
testing.
T
) {
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
time
.
Second
)
resp
,
err
:=
service
.
Options
(
ctx
,
&
v1.
SearchOptionsRequest
{
Categories
:
cat
})
cancel
()
require
.
NoError
(
t
,
err
)
if
len
(
cat
)
==
0
{
cat
=
search
.
GetGlobalSearchCategories
().
AsSlice
()
}
assert
.
ElementsMatch
(
t
,
options
.
GetOptions
(
cat
),
resp
.
GetOptions
())
})
}
}
func
TestOptionsMap
(
t
*
testing.
T
) {
expectedOptions
:=
[]
string
{
"Add Capabilities"
,
"Advisory Link"
,
"Advisory Name"
,
"CPU Cores Limit"
,
"CPU Cores Request"
,
"CVE"
,
"CVE Published On"
,
"CVE Snoozed"
,
"CVSS"
,
"Cluster"
,
"Component"
,
"Component Version"
,
"Container Type"
,
"Deployment"
,
"Deployment Annotation"
,
"Deployment Label"
,
"Deployment Type"
,
"Dockerfile Instruction Keyword"
,
"Dockerfile Instruction Value"
,
"Drop Capabilities"
,
"EPSS Probability"
,
"Environment Key"
,
"Environment Value"
,
"Environment Variable Source"
,
"Exposed Node Port"
,
"Exposing Service"
,
"Exposing Service Port"
,
"Exposure Level"
,
"External Hostname"
,
"External IP"
,
"Image"
,
"Image CVE Count"
,
"Image Command"
,
"Image Created Time"
,
"Image Entrypoint"
,
"Image Label"
,
"Image OS"
,
"Image Pull Secret"
,
"Image Registry"
,
"Image Remote"
,
"Image Scan Time"
,
"Image Tag"
,
"Image Top CVSS"
,
"Image User"
,
"Image Volumes"
,
"Max Exposure Level"
,
"Memory Limit (MB)"
,
"Memory Request (MB)"
,
"NVD CVSS"
,
"Namespace"
,
"Namespace ID"
,
"Orchestrator Component"
,
"Platform Component"
,
"Pod Label"
,
"Port"
,
"Port Protocol"
,
"Privileged"
,
"Process Arguments"
,
"Process Container Start Time"
,
"Process Name"
,
"Process Path"
,
"Process UID"
,
"Read Only Root Filesystem"
,
"Secret"
,
"Secret Path"
,
"Service Account"
,
"Service Account Permission Level"
,
"Volume Destination"
,
"Volume Name"
,
"Volume ReadOnly"
,
"Volume Source"
,
"Volume Type"
,
"Vulnerability State"
,
}
categories
:=
[]v1.
SearchCategory
{
v1
.
SearchCategory_DEPLOYMENTS
,
v1
.
SearchCategory_COMPONENT_VULN_EDGE
,
v1
.
SearchCategory_IMAGE_COMPONENT_EDGE
,
v1
.
SearchCategory_IMAGE_COMPONENTS
,
v1
.
SearchCategory_IMAGE_VULN_EDGE
,
v1
.
SearchCategory_IMAGE_VULNERABILITIES
,
v1
.
SearchCategory_IMAGES
,
v1
.
SearchCategory_NODE_COMPONENT_EDGE
,
v1
.
SearchCategory_NODE_COMPONENTS
,
v1
.
SearchCategory_NODE_VULNERABILITIES
,
v1
.
SearchCategory_NODES
,
}
for
_
,
category
:=
range
categories
{
t
.
Run
(
category
.
String
(),
func
(
t
*
testing.
T
) {
options
:=
options
.
GetOptions
([]v1.
SearchCategory
{
v1
.
SearchCategory_DEPLOYMENTS
})
assert
.
Equal
(
t
,
expectedOptions
,
options
)
})
}
}
Back
|
FazBrowse Home
|
New Git URL