Skip to content

Commit 5877cb2

Browse files
authored
Skip smoke test client on JDK 9
This commit adds an assumption to SmokeTestClientIT tests 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 #20260
1 parent bd93c70 commit 5877cb2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

qa/smoke-test-client/src/test/java/org/elasticsearch/smoketest/SmokeTestClientIT.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
package org.elasticsearch.smoketest;
2121

22+
import org.apache.lucene.util.Constants;
2223
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
2324
import org.elasticsearch.action.search.SearchResponse;
2425
import org.elasticsearch.client.Client;
@@ -27,10 +28,19 @@
2728
import static org.hamcrest.Matchers.greaterThan;
2829

2930
public class SmokeTestClientIT extends ESSmokeClientTestCase {
31+
32+
// needed to avoid the test suite from failing for having no tests
33+
// TODO: remove when Netty 4.1.5 is upgraded to Netty 4.1.6 including https://github.com/netty/netty/pull/5778
34+
public void testSoThatTestsDoNotFail() {
35+
36+
}
37+
3038
/**
3139
* Check that we are connected to a cluster named "elasticsearch".
3240
*/
3341
public void testSimpleClient() {
42+
// TODO: remove when Netty 4.1.5 is upgraded to Netty 4.1.6 including https://github.com/netty/netty/pull/5778
43+
assumeFalse("JDK is JDK 9", Constants.JRE_IS_MINIMUM_JAVA9);
3444
Client client = getClient();
3545

3646
// START SNIPPET: java-doc-admin-cluster-health
@@ -45,6 +55,8 @@ public void testSimpleClient() {
4555
* Create an index and index some docs
4656
*/
4757
public void testPutDocument() {
58+
// TODO: remove when Netty 4.1.5 is upgraded to Netty 4.1.6 including https://github.com/netty/netty/pull/5778
59+
assumeFalse("JDK is JDK 9", Constants.JRE_IS_MINIMUM_JAVA9);
4860
Client client = getClient();
4961

5062
// START SNIPPET: java-doc-index-doc-simple
@@ -63,5 +75,6 @@ public void testPutDocument() {
6375
assertThat(searchResponse.getHits().getTotalHits(), is(1L));
6476
// END SNIPPET: java-doc-search-simple
6577
}
78+
6679
}
6780

0 commit comments

Comments
 (0)