Skip to content

Commit e699c6e

Browse files
committed
Add test tasks for unpooled and direct buffer pooling to netty
Some netty behavior is controlled by system properties. While we want to test with the defaults for Elasticsearch for most tests, within netty we want to ensure these netty settings exhibit correct behavior. This commit adds variants of test and integTest tasks for netty which set the unpooled and direct buffer pooled allocators. relates elastic#45881
1 parent 8109a2c commit e699c6e

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

modules/transport-netty4/build.gradle

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
* under the License.
1818
*/
1919

20+
import org.elasticsearch.gradle.test.RestIntegTestTask
21+
2022
/*
2123
TODOs:
2224
* fix permissions such that only netty4 can open sockets etc?
@@ -67,6 +69,35 @@ integTestRunner {
6769
systemProperty 'io.netty.allocator.numDirectArenas', '0'
6870
}
6971

72+
TaskProvider<Test> unpooledTest = tasks.register("unpooledTest", Test) {
73+
include '**/*Tests.class'
74+
systemProperty 'es.set.netty.runtime.available.processors', 'false'
75+
systemProperty 'io.netty.allocator.type', 'unpooled'
76+
}
77+
TaskProvider<Test> directBufferPoolingTest = tasks.register("directBufferPoolingTest", Test) {
78+
include '**/*Tests.class'
79+
systemProperty 'es.set.netty.runtime.available.processors', 'false'
80+
systemProperty 'io.netty.allocator.numDirectArenas', '2'
81+
}
82+
// TODO: we can't use task avoidance here because RestIntegTestTask does the testcluster creation
83+
RestIntegTestTask unpooledIntegTest = tasks.create("unpooledIntegTest", RestIntegTestTask) {
84+
runner {
85+
systemProperty 'es.set.netty.runtime.available.processors', 'false'
86+
}
87+
}
88+
testClusters.unpooledIntegTest {
89+
systemProperty 'io.netty.allocator.type', 'unpooled'
90+
}
91+
RestIntegTestTask directBufferPoolingIntegTest = tasks.create("directBufferPoolingIntegTest", RestIntegTestTask) {
92+
runner {
93+
systemProperty 'es.set.netty.runtime.available.processors', 'false'
94+
}
95+
}
96+
testClusters.directBufferPoolingIntegTest {
97+
systemProperty 'io.netty.allocator.numDirectArenas', '2'
98+
}
99+
check.dependsOn(unpooledTest, directBufferPoolingTest, unpooledIntegTest, directBufferPoolingIntegTest)
100+
70101
thirdPartyAudit {
71102
ignoreMissingClasses (
72103
// classes are missing

0 commit comments

Comments
 (0)