@@ -23,6 +23,11 @@ plugins {
2323 id ' io.morethan.jmhreport' version ' 0.9.0' apply false
2424}
2525
26+ boolean isCiServer = [" CI" , " CONTINUOUS_INTEGRATION" , " TRAVIS" , " CIRCLECI" , " bamboo_planKey" , " GITHUB_ACTION" ]. with {
27+ retainAll(System . getenv(). keySet())
28+ return ! isEmpty()
29+ }
30+
2631subprojects {
2732 apply plugin : ' io.spring.dependency-management'
2833 apply plugin : ' com.github.sherter.google-java-format'
@@ -132,13 +137,6 @@ subprojects {
132137
133138 test {
134139 useJUnitPlatform()
135-
136- systemProperty " io.netty.leakDetection.level" , " ADVANCED"
137- }
138-
139- // all test tasks will show FAILED for each test method,
140- // common exclusions, no scanning
141- project. tasks. withType(Test ). all {
142140 testLogging {
143141 events " FAILED"
144142 showExceptions true
@@ -147,17 +145,44 @@ subprojects {
147145 maxGranularity 3
148146 }
149147
148+ // show progress by displaying test classes, avoiding test suite timeouts
149+ TestDescriptor last
150+ afterTest { TestDescriptor td , TestResult tr ->
151+ if (last != td. getParent()) {
152+ last = td. getParent()
153+ println last
154+ }
155+ }
156+
157+ if (isCiServer) {
158+ def stdout = new LinkedList<TestOutputEvent > ()
159+ beforeTest { TestDescriptor td ->
160+ stdout. clear()
161+ }
162+ onOutput { TestDescriptor td , TestOutputEvent toe ->
163+ stdout. add(toe)
164+ }
165+ afterTest { TestDescriptor td , TestResult tr ->
166+ if (tr. resultType == TestResult.ResultType . FAILURE && stdout. size() > 0 ) {
167+ def stdOutput = stdout. collect {
168+ it. getDestination(). name() == " StdErr"
169+ ? " STD_ERR: ${ it.getMessage()} "
170+ : " STD_OUT: ${ it.getMessage()} "
171+ }
172+ .join()
173+ println " This is the console output of the failing test below:\n $stdOutput "
174+ }
175+ }
176+ }
177+
150178 if (JavaVersion . current(). isJava9Compatible()) {
151179 println " Java 9+: lowering MaxGCPauseMillis to 20ms in ${ project.name} ${ name} "
152- jvmArgs = [" -XX:MaxGCPauseMillis=20" ]
180+ println " Java 9+: enabling leak detection [ADVANCED]"
181+ jvmArgs = [" -XX:MaxGCPauseMillis=20" , " -Dio.netty.leakDetection.level=ADVANCED" ]
153182 }
154183
155184 systemProperty(" java.awt.headless" , " true" )
156- systemProperty(" reactor.trace.cancel" , " true" )
157- systemProperty(" reactor.trace.nocapacity" , " true" )
158185 systemProperty(" testGroups" , project. properties. get(" testGroups" ))
159- scanForTestClasses = false
160- exclude ' **/*Abstract*.*'
161186
162187 // allow re-run of failed tests only without special test tasks failing
163188 // because the filter is too restrictive
0 commit comments