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

[v1] Backport fixes for hidden unit test failures #534

Merged
merged 2 commits into from
Jun 23, 2021
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
13 changes: 2 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
<cryostat.itest.podName>cryostat-itests</cryostat.itest.podName>

<org.apache.maven.plugins.compiler.version>3.6.1</org.apache.maven.plugins.compiler.version>
<org.apache.maven.plugins.surefire.version>3.0.0-M4</org.apache.maven.plugins.surefire.version>
<org.apache.maven.plugins.failsafe.version>3.0.0-M4</org.apache.maven.plugins.failsafe.version>
<org.apache.maven.plugins.surefire.version>2.22.2</org.apache.maven.plugins.surefire.version>
<org.apache.maven.plugins.failsafe.version>${org.apache.maven.plugins.surefire.version}</org.apache.maven.plugins.failsafe.version>
<org.apache.maven.plugins.site.version>3.8.2</org.apache.maven.plugins.site.version>
<org.apache.maven.plugins.info.reports.version>3.0.0</org.apache.maven.plugins.info.reports.version>
<org.apache.maven.plugins.clean.version>3.1.0</org.apache.maven.plugins.clean.version>
Expand Down Expand Up @@ -338,15 +338,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${org.apache.maven.plugins.surefire.version}</version>
<configuration>
<properties>
<configurationParameters>
junit.jupiter.execution.parallel.enabled=true
junit.jupiter.execution.parallel.mode.default=same_thread
junit.jupiter.execution.parallel.mode.classes.default=concurrent
</configurationParameters>
</properties>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void handleAuthenticated(RoutingContext ctx) throws Exception {
MultiMap attrs = ctx.request().formAttributes();
if (attrs.contains("toDisk")) {
Matcher m = bool.matcher(attrs.get("toDisk"));
if (!m.find()) throw new HttpStatusException(400, "Invalid options");
if (!m.matches()) throw new HttpStatusException(400, "Invalid options");
}
Arrays.asList("maxAge", "maxSize")
.forEach(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ void handleAuthenticated(RoutingContext ctx) throws Exception {
if (attrs.contains("toDisk")) {
Pattern bool = Pattern.compile("true|false");
Matcher m = bool.matcher(attrs.get("toDisk"));
if (!m.find())
if (!m.matches())
throw new HttpStatusException(400, "Invalid options");
builder = builder.toDisk(Boolean.valueOf(attrs.get("toDisk")));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,10 @@ void shouldThrowInvalidOptionException(Map<String, String> defaultValues) throws

private static Stream<Map<String, String>> getRequestMaps() {
return Stream.of(
Map.of("toDisk", null),
Map.of("toDisk", ""),
Map.of("toDisk", "5"),
Map.of("toDisk", "T"),
Map.of("toDisk", "false1"),
Map.of("maxAge", null),
Map.of("maxAge", ""),
Map.of("maxAge", "true"),
Map.of("maxAge", "1e3"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,15 @@ void shouldThrowInvalidOptionException(Map<String, String> requestValues) throws
arg0.getArgument(1))
.execute(connection));
Mockito.when(connection.getService()).thenReturn(service);
Mockito.when(service.getAvailableRecordings())
.thenReturn(Collections.emptyList())
.thenReturn(Arrays.asList(existingRecording));
RecordingOptionsBuilder recordingOptionsBuilder =
Mockito.mock(RecordingOptionsBuilder.class);
Mockito.when(recordingOptionsBuilderFactory.create(Mockito.any()))
.thenReturn(recordingOptionsBuilder);
Mockito.when(recordingOptionsBuilder.name(Mockito.any()))
.thenReturn(recordingOptionsBuilder);

Mockito.when(ctx.pathParam("targetId")).thenReturn("fooHost:9091");
MultiMap attrs = MultiMap.caseInsensitiveMultiMap();
Expand All @@ -317,16 +326,13 @@ void shouldThrowInvalidOptionException(Map<String, String> requestValues) throws

private static Stream<Map<String, String>> getRequestMaps() {
return Stream.of(
Map.of("duration", null),
Map.of("duration", ""),
Map.of("duration", "t"),
Map.of("duration", "90s"),
Map.of("toDisk", null),
Map.of("toDisk", ""),
Map.of("toDisk", "5"),
Map.of("toDisk", "T"),
Map.of("toDisk", "false1"),
Map.of("maxAge", null),
Map.of("maxAge", ""),
Map.of("maxAge", "true"),
Map.of("maxAge", "1e3"),
Expand Down