Skip to content

Commit 7d19d91

Browse files
authored
Update schema to include names in image added in 3.74 (#231)
1 parent 6380360 commit 7d19d91

3 files changed

Lines changed: 24 additions & 3 deletions

File tree

stackrox-container-image-scanner/api.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11665,6 +11665,10 @@ components:
1166511665
type: string
1166611666
name:
1166711667
$ref: '#/components/schemas/storageImageName'
11668+
names:
11669+
type: array
11670+
items:
11671+
$ref: '#/components/schemas/storageImageName'
1166811672
metadata:
1166911673
$ref: '#/components/schemas/storageImageMetadata'
1167011674
scan:

stackrox-container-image-scanner/src/test/java/com/stackrox/jenkins/plugins/services/ImageServiceTest.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525
import org.junit.jupiter.api.BeforeEach;
2626
import org.junit.jupiter.api.Test;
27+
import org.junit.jupiter.params.ParameterizedTest;
28+
import org.junit.jupiter.params.provider.ValueSource;
2729

2830
class ImageServiceTest extends AbstractServiceTest {
2931

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

63-
@Test
64-
public void shouldNotFailOnMissingData() throws IOException {
65+
@ParameterizedTest
66+
@ValueSource(strings = {"minimal.json", "minimal-with-names.json"})
67+
public void shouldNotFailOnMissingData(String file) throws IOException {
6568
MOCK_SERVER.stubFor(postImagesScan().willReturn(
66-
ok().withBodyFile("v1/images/scan/minimal.json")));
69+
ok().withBodyFile("v1/images/scan/" + file)));
6770
List<CVE> actual = imageService.getImageScanResults("nginx:latest");
6871
ImmutableList<CVE> expected = ImmutableList.of(
6972
new CVE(null, null, new StorageEmbeddedVulnerability()
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"names": [{}],
3+
"scan": {
4+
"components": [
5+
{
6+
"vulns": [
7+
{
8+
"cve": "CVE-MISSING-DATA"
9+
}
10+
]
11+
}
12+
]
13+
}
14+
}

0 commit comments

Comments
 (0)