Skip to content

Commit 6f8a047

Browse files
authored
Skip transport client plugin installed on JDK 9
This commit adds an assumption to PreBuiltTransportClientTests#testPluginInstalled on JDK 9. The underlying issue is that Netty attempts to access sun.nio.ch but this package is not exported from java.base on JDK 9. This throws an uncaught InaccessibleObjectException causing the test to fail. This assumption can be removed when Netty 4.1.6 is released as it will include a fix for this scenario. Relates #20251
1 parent 0c027ac commit 6f8a047

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

client/transport/src/test/java/org/elasticsearch/transport/client/PreBuiltTransportClientTests.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
package org.elasticsearch.transport.client;
2121

2222
import com.carrotsearch.randomizedtesting.RandomizedTest;
23+
import org.apache.lucene.util.Constants;
2324
import org.elasticsearch.client.transport.TransportClient;
2425
import org.elasticsearch.common.network.NetworkModule;
2526
import org.elasticsearch.common.settings.Settings;
@@ -40,6 +41,8 @@ public class PreBuiltTransportClientTests extends RandomizedTest {
4041

4142
@Test
4243
public void testPluginInstalled() {
44+
// TODO: remove when Netty 4.1.5 is upgraded to Netty 4.1.6 including https://github.com/netty/netty/pull/5778
45+
assumeFalse(Constants.JRE_IS_MINIMUM_JAVA9);
4346
try (TransportClient client = new PreBuiltTransportClient(Settings.EMPTY)) {
4447
Settings settings = client.settings();
4548
assertEquals(Netty4Plugin.NETTY_TRANSPORT_NAME, NetworkModule.HTTP_DEFAULT_TYPE_SETTING.get(settings));
@@ -49,9 +52,7 @@ public void testPluginInstalled() {
4952

5053
@Test
5154
public void testInstallPluginTwice() {
52-
53-
for (Class<? extends Plugin> plugin : Arrays.asList(ReindexPlugin.class, PercolatorPlugin.class,
54-
MustachePlugin.class)) {
55+
for (Class<? extends Plugin> plugin : Arrays.asList(ReindexPlugin.class, PercolatorPlugin.class, MustachePlugin.class)) {
5556
try {
5657
new PreBuiltTransportClient(Settings.EMPTY, plugin);
5758
fail("exception expected");

0 commit comments

Comments
 (0)