Skip to content

Commit b48d8ad

Browse files
committed
Added istio request handler and e2e test
1 parent de7a831 commit b48d8ad

File tree

4 files changed

+208
-35
lines changed

4 files changed

+208
-35
lines changed

e2etests/orchestrator_scan_test.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,34 @@ var (
2020
patchRegex = regexp.MustCompile(`^[0-9]+\.[0-9]+\.([0-9]+)$`)
2121
)
2222

23+
func TestGRPCGetIstioVulnerabilities(t *testing.T) {
24+
conn := connectToScanner(t)
25+
client := v1.NewOrchestratorScanServiceClient(conn)
26+
27+
testCases := []*struct {
28+
addressFamily string
29+
knownFixed string
30+
}{
31+
{
32+
addressFamily: "1.13.6",
33+
knownFixed: "1.13.7",
34+
},
35+
}
36+
37+
for _, c := range testCases {
38+
t.Run(fmt.Sprintf("case-%s", c.addressFamily), func(t *testing.T) {
39+
req := &v1.GetIstioVulnerabilitiesRequest{IstioVersion: c.addressFamily}
40+
resp, err := client.GetIstioVulnerabilities(context.Background(), req)
41+
assert.NoError(t, err)
42+
for _, vuln := range resp.GetVulnerabilities() {
43+
assert.True(t, vuln.MetadataV2.CvssV3 != nil)
44+
assert.True(t, vuln.FixedBy != "")
45+
assert.Equal(t, vuln.FixedBy, c.knownFixed)
46+
}
47+
})
48+
}
49+
}
50+
2351
func TestGRPCGetOpenShiftVulnerabilities(t *testing.T) {
2452
conn := connectToScanner(t)
2553
client := v1.NewOrchestratorScanServiceClient(conn)

generated/scanner/api/v1/orchestrator_scan_service.pb.go

Lines changed: 73 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generated/scanner/api/v1/orchestrator_scan_service.pb.gw.go

Lines changed: 101 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/scanner/api/v1/orchestrator_scan_service.proto

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,10 @@ service OrchestratorScanService {
5454
get: "/v1/orchestrator/openshift/vulnerabilities"
5555
};
5656
}
57+
58+
rpc GetIstioVulnerabilities(GetIstioVulnerabilitiesRequest) returns (GetIstioVulnerabilitiesResponse) {
59+
option (google.api.http) = {
60+
get: "/v1/orchestrator/istio/vulnerabilities/{istio_version}"
61+
};
62+
}
5763
}

0 commit comments

Comments
 (0)