Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
}
]
}
]
}
}