KEYCLOAK-9640 Unify surefire versions

This commit is contained in:
Sebastian Laskawiec 2019-06-11 10:01:13 +02:00 committed by Hynek Mlnařík
parent c230ccb7e8
commit e739344556
4 changed files with 39 additions and 32 deletions

View file

@ -35,7 +35,6 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>2.8.1</version>
<configuration> <configuration>
<redirectTestOutputToFile>false</redirectTestOutputToFile> <redirectTestOutputToFile>false</redirectTestOutputToFile>
<enableAssertions>true</enableAssertions> <enableAssertions>true</enableAssertions>

View file

@ -40,7 +40,6 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>2.8.1</version>
<configuration> <configuration>
<redirectTestOutputToFile>false</redirectTestOutputToFile> <redirectTestOutputToFile>false</redirectTestOutputToFile>
<enableAssertions>true</enableAssertions> <enableAssertions>true</enableAssertions>

View file

@ -261,7 +261,6 @@
</plugin> </plugin>
<plugin> <plugin>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration> <configuration>
<failIfNoTests>false</failIfNoTests> <failIfNoTests>false</failIfNoTests>
</configuration> </configuration>

View file

@ -1,44 +1,54 @@
package org.keycloak.testsuite; package org.keycloak.testsuite;
import java.io.BufferedReader; import java.util.Scanner;
import java.io.IOException; import java.util.regex.Matcher;
import java.io.InputStreamReader; import java.util.regex.Pattern;
/** /**
* A simple utility class for trimming test output (if successful).
*
* Created to shrink down the output for Travis.
*
* Created by st on 03/07/17. * Created by st on 03/07/17.
*/ */
public class LogTrimmer { public class LogTrimmer {
public static void main(String[] args) throws IOException { private static Pattern TEST_START_PATTERN = Pattern.compile("(\\[INFO\\] )?Running (.*)");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); private static int TEST_NAME_GROUP = 2;
public static void main(String[] args) {
try (Scanner scanner = new Scanner(System.in)) {
String testRunning = null; String testRunning = null;
StringBuilder sb = new StringBuilder(); String line = null;
for(String l = br.readLine(); l != null; l = br.readLine()) { Matcher testMatcher = null;
StringBuilder testText = new StringBuilder();
while (scanner.hasNextLine()) {
line = scanner.nextLine();
if (testRunning == null) { if (testRunning == null) {
if (l.startsWith("Running")) { testMatcher = TEST_START_PATTERN.matcher(line);
testRunning = l.split(" ")[1]; if (testMatcher.find()) {
System.out.println(l); testRunning = testMatcher.group(TEST_NAME_GROUP);
System.out.println(line);
} else { } else {
System.out.println("-- " + l); System.out.println("-- " + line);
} }
} else { } else {
if (l.contains("Tests run:")) { if (line.contains("Tests run:")) {
if (!(l.contains("Failures: 0") && l.contains("Errors: 0"))) { if (!(line.contains("Failures: 0") && line.contains("Errors: 0"))) {
System.out.println("--------- " + testRunning + " output start ---------"); System.out.println("--------- " + testRunning + " output start ---------");
System.out.println(sb.toString()); System.out.println(testText.toString());
System.out.println("--------- " + testRunning + " output end ---------"); System.out.println("--------- " + testRunning + " output end ---------");
} }
System.out.println(l); System.out.println(line);
testRunning = null; testRunning = null;
sb = new StringBuilder(); testText = new StringBuilder();
} else { } else {
sb.append(testRunning.substring(testRunning.lastIndexOf('.') + 1) + " ++ " + l); testText.append(testRunning.substring(testRunning.lastIndexOf('.') + 1) + " ++ " + line);
sb.append("\n"); testText.append("\n");
}
} }
} }
} }
} }
} }