Skip to content

Commit 11ca271

Browse files
authored
improves build.gradle tests (#897)
Signed-off-by: Oleh Dokuka <shadowgun@i.ua>
1 parent d6e3382 commit 11ca271

File tree

2 files changed

+40
-13
lines changed

2 files changed

+40
-13
lines changed

build.gradle

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
2631
subprojects {
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

rsocket-core/src/test/java/io/rsocket/core/RSocketRequesterSubscribersTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,9 @@ void singleSubscriberInCaseOfRacing(Function<RSocket, Publisher<?>> interaction)
119119
Assertions.assertThat(connection.getSent())
120120
.hasSize(1)
121121
.first()
122-
.matches(bb -> REQUEST_TYPES.contains(FrameHeaderCodec.frameType(bb)));
122+
.matches(bb -> REQUEST_TYPES.contains(FrameHeaderCodec.frameType(bb)))
123+
.matches(ByteBuf::release);
124+
123125
connection.clearSendReceiveBuffers();
124126
}
125127
}

0 commit comments

Comments
 (0)