Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ROX-11370: allow unknown enum values #153

Closed
Show file tree
Hide file tree
Changes from 5 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
1 change: 1 addition & 0 deletions functionaltest-jenkins-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ test {
}

repositories {
mavenLocal()
mavenCentral()
maven {
url 'https://repo.jenkins-ci.org/releases'
Expand Down
28 changes: 27 additions & 1 deletion stackrox-container-image-scanner/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@
<version>4.5.13</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
Expand Down Expand Up @@ -170,8 +175,28 @@
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</repository>
<repository>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When 6.0.1 will be released we can remove this

<id>oss.sonatype.org-snapshot</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When 6.0.1 will be released we can remove this

<id>oss.sonatype.org-snapshot</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
Expand Down Expand Up @@ -203,7 +228,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>6.0.0</version>
<version>6.0.1-SNAPSHOT</version>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can wait for dependabot to update this deps so we don't need snapshot repository

Suggested change
<version>6.0.1-SNAPSHOT</version>
<version>6.0.1</version>

<!-- /RELEASE_VERSION -->
<executions>
<execution>
Expand All @@ -224,6 +249,7 @@
<dateLibrary>java8</dateLibrary>
<java8>true</java8>
<sourceFolder>src/gen/java/main</sourceFolder>
<enumUnknownDefaultCase>true</enumUnknownDefaultCase>
</configOptions>
</configuration>
</execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,19 @@ public void shouldNotFailOnMissingData() throws IOException {
assertEquals(expected, actual);
}

@Test
public void shouldNotFailOnUnknownEnumValue() throws IOException {
MOCK_SERVER.stubFor(postImagesScan().willReturn(
ok().withBodyFile("v1/images/scan/unknown-enum.json")));
List<CVE> actual = imageService.getImageScanResults("nginx:latest");
ImmutableList<CVE> expected = ImmutableList.of(
new CVE(null, null, new StorageEmbeddedVulnerability()
.cve("CVE-MISSING-DATA")
.scoreVersion(V2))
);
assertEquals(expected, actual);
}

private MappingBuilder postImagesScan() {
return post(urlEqualTo("/v1/images/scan"))
.withHeader("Authorization", equalTo("Bearer {some token}"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@ class ServiceExceptionTest {
@DisplayName("ServiceException message")
@ParameterizedTest(name = "should be \"{2}\" when response body \"{0}\"")
@CsvSource({
",,Status code: 500.",
",API Message,Status code: 500. Error: API Message",
",,'Status code: 500. Error: Message: null\n" +
"HTTP response code: 500\n" +
"HTTP response body: null\n" +
"HTTP response headers: null'",
",API Message,'Status code: 500. Error: Message: API Message\n" +
"HTTP response code: 500\n" +
"HTTP response body: null\n" +
"HTTP response headers: null'",
"{},,Status code: 500.",
"{\"message\":\"some error\"},,Status code: 500. Error: some error",
"not a json,,Status code: 500. Response body: not a json"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"scan": {
"components": [
{
"vulns": [
{
"cve": "CVE-MISSING-DATA"
}
]
}
],
"notes": [
"UNKNOWN VALUE"
]
}
}