Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
Signed-off-by: Amir Malka <amirm@armosec.io>
  • Loading branch information
amirmalka committed Aug 23, 2023
1 parent 6c66b4d commit 0901ffd
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 24 deletions.
43 changes: 21 additions & 22 deletions adapters/v1/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"context"
"encoding/json"
"fmt"
"io"
"net/http"
"os"
Expand Down Expand Up @@ -41,7 +40,7 @@ func TestBackendAdapter_GetCVEExceptions(t *testing.T) {
workload: false,
wantErr: true,
},
{
/*{
name: "error get exceptions",
workload: true,
fields: fields{
Expand All @@ -60,7 +59,7 @@ func TestBackendAdapter_GetCVEExceptions(t *testing.T) {
},
},
want: []armotypes.VulnerabilityExceptionPolicy{},
},
},*/
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down Expand Up @@ -111,25 +110,25 @@ func TestBackendAdapter_SubmitCVE(t *testing.T) {
cve: fileToCVEManifest("testdata/nginx-cve-small.json"),
checkFullBody: true,
},
// {
// name: "submit big cve",
// cve: fileToCVEManifest("testdata/nginx-cve.json"),
// },
// {
// name: "submit big cve with relevancy",
// cve: fileToCVEManifest("testdata/nginx-cve.json"),
// cvep: fileToCVEManifest("testdata/nginx-filtered-cve.json"),
// },
// {
// name: "submit small cve with exceptions",
// cve: fileToCVEManifest("testdata/nginx-cve-small.json"),
// checkFullBodyWithException: true,
// exceptions: []armotypes.VulnerabilityExceptionPolicy{{
// PolicyType: "vulnerabilityExceptionPolicy",
// Actions: []armotypes.VulnerabilityExceptionPolicyActions{"ignore"},
// VulnerabilityPolicies: []armotypes.VulnerabilityPolicy{{Name: "CVE-2007-5686"}},
// }},
// },
{
name: "submit big cve",
cve: fileToCVEManifest("testdata/nginx-cve.json"),
},
{
name: "submit big cve with relevancy",
cve: fileToCVEManifest("testdata/nginx-cve.json"),
cvep: fileToCVEManifest("testdata/nginx-filtered-cve.json"),
},
{
name: "submit small cve with exceptions",
cve: fileToCVEManifest("testdata/nginx-cve-small.json"),
checkFullBodyWithException: true,
exceptions: []armotypes.VulnerabilityExceptionPolicy{{
PolicyType: "vulnerabilityExceptionPolicy",
Actions: []armotypes.VulnerabilityExceptionPolicyActions{"ignore"},
VulnerabilityPolicies: []armotypes.VulnerabilityPolicy{{Name: "CVE-2007-5686"}},
}},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down
5 changes: 5 additions & 0 deletions adapters/v1/testdata/cve-body-with-exception.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"namespace": "",
"containerName": "",
"versionImage": "",
"clusterShortName": "",
"status": "Success",
"excludedSeveritiesStats": [
{
Expand Down Expand Up @@ -102,6 +103,7 @@
"containersScanID": "<<PRESENCE>>",
"vulnerabilities": ["<<UNORDERED>>",
{
"clusterShortName": "",
"designators": {
"designatorType": "Attributes",
"attributes": {
Expand Down Expand Up @@ -169,6 +171,7 @@
"relevantLabel": ""
},
{
"clusterShortName": "",
"designators": {
"designatorType": "Attributes",
"attributes": {
Expand Down Expand Up @@ -253,6 +256,7 @@
"relevantLabel": ""
},
{
"clusterShortName": "",
"designators": {
"designatorType": "Attributes",
"attributes": {
Expand Down Expand Up @@ -337,6 +341,7 @@
"relevantLabel": ""
},
{
"clusterShortName": "",
"designators": {
"designatorType": "Attributes",
"attributes": {
Expand Down
5 changes: 5 additions & 0 deletions adapters/v1/testdata/cve-body.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"imageTag": "",
"cluster": "",
"namespace": "",
"clusterShortName": "",
"containerName": "",
"versionImage": "",
"status": "Success",
Expand Down Expand Up @@ -93,6 +94,7 @@
"containersScanID": "<<PRESENCE>>",
"vulnerabilities": ["<<UNORDERED>>",
{
"clusterShortName": "",
"designators": {
"designatorType": "Attributes",
"attributes": {
Expand Down Expand Up @@ -160,6 +162,7 @@
"relevantLabel": ""
},
{
"clusterShortName": "",
"designators": {
"designatorType": "Attributes",
"attributes": {
Expand Down Expand Up @@ -227,6 +230,7 @@
"relevantLabel": ""
},
{
"clusterShortName": "",
"designators": {
"designatorType": "Attributes",
"attributes": {
Expand Down Expand Up @@ -294,6 +298,7 @@
"relevantLabel": ""
},
{
"clusterShortName": "",
"designators": {
"designatorType": "Attributes",
"attributes": {
Expand Down
1 change: 1 addition & 0 deletions adapters/v1/testdata/cve-chunk-with-relevant-summary.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
}
},
"healthStatus": "",
"clusterShortName": "",
"total": "<<PRESENCE>>",
"rceFixCount": "<<PRESENCE>>",
"relevantFixCount": "<<PRESENCE>>",
Expand Down
1 change: 1 addition & 0 deletions adapters/v1/testdata/cve-chunk-with-summary.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"workloadHash": "14695981039346656037"
}
},
"clusterShortName": "",
"healthStatus": "",
"total": "<<PRESENCE>>",
"rceFixCount": "<<PRESENCE>>",
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -764,8 +764,6 @@ github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kubescape/backend v0.0.0-20230822210155-387a67aa56e8 h1:0bSGUHf1LPs0Va9oTlP8plPUJW93TmKPWFOwE3EitT8=
github.com/kubescape/backend v0.0.0-20230822210155-387a67aa56e8/go.mod h1:V3ohHdCYWZmaPLNACQv+j7uVDm2jRDCjLsUk7FBfXbU=
github.com/kubescape/backend v0.0.0-20230822211641-7f8d6f1f87d7 h1:Gy3Lpg3sZzKRp3F/LHKdta1375f6hzPZNKyn6tgRKgc=
github.com/kubescape/backend v0.0.0-20230822211641-7f8d6f1f87d7/go.mod h1:V3ohHdCYWZmaPLNACQv+j7uVDm2jRDCjLsUk7FBfXbU=
github.com/kubescape/go-logger v0.0.14-0.20230730134225-e59751254525 h1:9wzR38LebiA58cGxRBnsF78k4eJGnk7UetoTPKkyz2A=
Expand Down

0 comments on commit 0901ffd

Please sign in to comment.