Skip to content

Commit

Permalink
Update schema to include names in image added in 3.74 (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
janisz authored Mar 16, 2023
1 parent 6380360 commit 7d19d91
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
4 changes: 4 additions & 0 deletions stackrox-container-image-scanner/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11665,6 +11665,10 @@ components:
type: string
name:
$ref: '#/components/schemas/storageImageName'
names:
type: array
items:
$ref: '#/components/schemas/storageImageName'
metadata:
$ref: '#/components/schemas/storageImageMetadata'
scan:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;

class ImageServiceTest extends AbstractServiceTest {

Expand Down Expand Up @@ -60,10 +62,11 @@ public void shouldThrowWhenNoDataFor200() throws IOException {
assertEquals("Did not get scan results from StackRox", exception.getMessage());
}

@Test
public void shouldNotFailOnMissingData() throws IOException {
@ParameterizedTest
@ValueSource(strings = {"minimal.json", "minimal-with-names.json"})
public void shouldNotFailOnMissingData(String file) throws IOException {
MOCK_SERVER.stubFor(postImagesScan().willReturn(
ok().withBodyFile("v1/images/scan/minimal.json")));
ok().withBodyFile("v1/images/scan/" + file)));
List<CVE> actual = imageService.getImageScanResults("nginx:latest");
ImmutableList<CVE> expected = ImmutableList.of(
new CVE(null, null, new StorageEmbeddedVulnerability()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"names": [{}],
"scan": {
"components": [
{
"vulns": [
{
"cve": "CVE-MISSING-DATA"
}
]
}
]
}
}

0 comments on commit 7d19d91

Please sign in to comment.