fix gradle check under jigsaw
closes #14726 Squashed commit of the following: commit 5b591e98570e3fa481b2816a44063b98bff36ddf Author: Robert Muir <rmuir@apache.org> Date: Fri Nov 13 00:54:08 2015 -0500 add assumption for self-signing in PluginManagerTests commit ed11e5371b6f71591dc41c6f60d033502cfcf029 Author: Robert Muir <rmuir@apache.org> Date: Fri Nov 13 00:20:59 2015 -0500 show error output from integ test startup commit d8b187a10e95d89a0e775333dcbe1aaa903fb376 Author: Robert Muir <rmuir@apache.org> Date: Thu Nov 12 22:14:11 2015 -0500 fix gradle check under jigsaw
This commit is contained in:
parent
dc77815744
commit
776bb288b5
|
@ -264,16 +264,7 @@ class ClusterFormationTasks {
|
||||||
args esExecutable
|
args esExecutable
|
||||||
args esProps
|
args esProps
|
||||||
environment esEnv
|
environment esEnv
|
||||||
errorOutput = new ByteArrayOutputStream()
|
|
||||||
doLast {
|
doLast {
|
||||||
if (errorOutput.toString().isEmpty() == false) {
|
|
||||||
logger.error(errorOutput.toString())
|
|
||||||
File logFile = new File(home, "logs/${clusterName}.log")
|
|
||||||
if (logFile.exists()) {
|
|
||||||
logFile.eachLine { line -> logger.error(line) }
|
|
||||||
}
|
|
||||||
throw new GradleException('Failed to start elasticsearch')
|
|
||||||
}
|
|
||||||
esPostStartActions(ant, logger)
|
esPostStartActions(ant, logger)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -336,12 +336,7 @@ public class ESExceptionTests extends ESTestCase {
|
||||||
} else {
|
} else {
|
||||||
assertEquals(e.getCause().getClass(), NotSerializableExceptionWrapper.class);
|
assertEquals(e.getCause().getClass(), NotSerializableExceptionWrapper.class);
|
||||||
}
|
}
|
||||||
// TODO: fix this test
|
|
||||||
// on java 9, expected:<sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)>
|
|
||||||
// but was:<sun.reflect.NativeMethodAccessorImpl.invoke0(java.base@9.0/Native Method)>
|
|
||||||
if (!Constants.JRE_IS_MINIMUM_JAVA9) {
|
|
||||||
assertArrayEquals(e.getStackTrace(), ex.getStackTrace());
|
assertArrayEquals(e.getStackTrace(), ex.getStackTrace());
|
||||||
}
|
|
||||||
assertTrue(e.getStackTrace().length > 1);
|
assertTrue(e.getStackTrace().length > 1);
|
||||||
ElasticsearchAssertions.assertVersionSerializable(VersionUtils.randomVersion(getRandom()), t);
|
ElasticsearchAssertions.assertVersionSerializable(VersionUtils.randomVersion(getRandom()), t);
|
||||||
ElasticsearchAssertions.assertVersionSerializable(VersionUtils.randomVersion(getRandom()), ex);
|
ElasticsearchAssertions.assertVersionSerializable(VersionUtils.randomVersion(getRandom()), ex);
|
||||||
|
|
|
@ -561,8 +561,6 @@ public class ExceptionSerializationTests extends ESTestCase {
|
||||||
}
|
}
|
||||||
Throwable deserialized = serialize(t);
|
Throwable deserialized = serialize(t);
|
||||||
assertTrue(deserialized instanceof NotSerializableExceptionWrapper);
|
assertTrue(deserialized instanceof NotSerializableExceptionWrapper);
|
||||||
// TODO: fix this test for more java 9 differences
|
|
||||||
if (!Constants.JRE_IS_MINIMUM_JAVA9) {
|
|
||||||
assertArrayEquals(t.getStackTrace(), deserialized.getStackTrace());
|
assertArrayEquals(t.getStackTrace(), deserialized.getStackTrace());
|
||||||
assertEquals(t.getSuppressed().length, deserialized.getSuppressed().length);
|
assertEquals(t.getSuppressed().length, deserialized.getSuppressed().length);
|
||||||
if (t.getSuppressed().length > 0) {
|
if (t.getSuppressed().length > 0) {
|
||||||
|
@ -572,7 +570,6 @@ public class ExceptionSerializationTests extends ESTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void testWithRestHeadersException() throws IOException {
|
public void testWithRestHeadersException() throws IOException {
|
||||||
ElasticsearchException ex = new ElasticsearchException("msg");
|
ElasticsearchException ex = new ElasticsearchException("msg");
|
||||||
|
|
|
@ -1387,7 +1387,7 @@ public class StoreTests extends ESTestCase {
|
||||||
} catch (CorruptIndexException e) {
|
} catch (CorruptIndexException e) {
|
||||||
assertEquals(ex.getMessage(), e.getMessage());
|
assertEquals(ex.getMessage(), e.getMessage());
|
||||||
assertEquals(ex.toString(), e.toString());
|
assertEquals(ex.toString(), e.toString());
|
||||||
assertEquals(ExceptionsHelper.stackTrace(ex), ExceptionsHelper.stackTrace(e));
|
assertArrayEquals(ex.getStackTrace(), e.getStackTrace());
|
||||||
}
|
}
|
||||||
|
|
||||||
store.removeCorruptionMarker();
|
store.removeCorruptionMarker();
|
||||||
|
@ -1399,7 +1399,7 @@ public class StoreTests extends ESTestCase {
|
||||||
fail("should be corrupted");
|
fail("should be corrupted");
|
||||||
} catch (CorruptIndexException e) {
|
} catch (CorruptIndexException e) {
|
||||||
assertEquals("foobar (resource=preexisting_corruption)", e.getMessage());
|
assertEquals("foobar (resource=preexisting_corruption)", e.getMessage());
|
||||||
assertEquals(ExceptionsHelper.stackTrace(ioe), ExceptionsHelper.stackTrace(e.getCause()));
|
assertArrayEquals(ioe.getStackTrace(), e.getCause().getStackTrace());
|
||||||
}
|
}
|
||||||
store.close();
|
store.close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -661,9 +661,14 @@ public class PluginManagerTests extends ESIntegTestCase {
|
||||||
|
|
||||||
SSLSocketFactory defaultSocketFactory = HttpsURLConnection.getDefaultSSLSocketFactory();
|
SSLSocketFactory defaultSocketFactory = HttpsURLConnection.getDefaultSSLSocketFactory();
|
||||||
ServerBootstrap serverBootstrap = new ServerBootstrap(new NioServerSocketChannelFactory());
|
ServerBootstrap serverBootstrap = new ServerBootstrap(new NioServerSocketChannelFactory());
|
||||||
SelfSignedCertificate ssc = new SelfSignedCertificate("localhost");
|
SelfSignedCertificate ssc = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
try {
|
||||||
|
ssc = new SelfSignedCertificate("localhost");
|
||||||
|
} catch (Exception e) {
|
||||||
|
assumeNoException("self signing shenanigans not supported by this JDK", e);
|
||||||
|
}
|
||||||
|
|
||||||
// Create a trust manager that does not validate certificate chains:
|
// Create a trust manager that does not validate certificate chains:
|
||||||
SSLContext sc = SSLContext.getInstance("SSL");
|
SSLContext sc = SSLContext.getInstance("SSL");
|
||||||
|
@ -700,9 +705,11 @@ public class PluginManagerTests extends ESIntegTestCase {
|
||||||
} finally {
|
} finally {
|
||||||
HttpsURLConnection.setDefaultSSLSocketFactory(defaultSocketFactory);
|
HttpsURLConnection.setDefaultSSLSocketFactory(defaultSocketFactory);
|
||||||
serverBootstrap.releaseExternalResources();
|
serverBootstrap.releaseExternalResources();
|
||||||
|
if (ssc != null) {
|
||||||
ssc.delete();
|
ssc.delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static class LoggingServerHandler extends SimpleChannelUpstreamHandler {
|
private static class LoggingServerHandler extends SimpleChannelUpstreamHandler {
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;
|
||||||
import org.apache.lucene.util.TestRuleMarkFailure;
|
import org.apache.lucene.util.TestRuleMarkFailure;
|
||||||
import org.apache.lucene.util.TestUtil;
|
import org.apache.lucene.util.TestUtil;
|
||||||
import org.apache.lucene.util.TimeUnits;
|
import org.apache.lucene.util.TimeUnits;
|
||||||
|
import org.elasticsearch.ExceptionsHelper;
|
||||||
import org.elasticsearch.Version;
|
import org.elasticsearch.Version;
|
||||||
import org.elasticsearch.bootstrap.BootstrapForTesting;
|
import org.elasticsearch.bootstrap.BootstrapForTesting;
|
||||||
import org.elasticsearch.cache.recycler.MockPageCacheRecycler;
|
import org.elasticsearch.cache.recycler.MockPageCacheRecycler;
|
||||||
|
@ -616,4 +617,21 @@ public abstract class ESTestCase extends LuceneTestCase {
|
||||||
public static TestRuleMarkFailure getSuiteFailureMarker() {
|
public static TestRuleMarkFailure getSuiteFailureMarker() {
|
||||||
return suiteFailureMarker;
|
return suiteFailureMarker;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Compares two stack traces, ignoring module (which is not yet serialized) */
|
||||||
|
public static void assertArrayEquals(StackTraceElement expected[], StackTraceElement actual[]) {
|
||||||
|
assertEquals(expected.length, actual.length);
|
||||||
|
for (int i = 0; i < expected.length; i++) {
|
||||||
|
assertEquals(expected[i], actual[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Compares two stack trace elements, ignoring module (which is not yet serialized) */
|
||||||
|
public static void assertEquals(StackTraceElement expected, StackTraceElement actual) {
|
||||||
|
assertEquals(expected.getClassName(), actual.getClassName());
|
||||||
|
assertEquals(expected.getMethodName(), actual.getMethodName());
|
||||||
|
assertEquals(expected.getFileName(), actual.getFileName());
|
||||||
|
assertEquals(expected.getLineNumber(), actual.getLineNumber());
|
||||||
|
assertEquals(expected.isNativeMethod(), actual.isNativeMethod());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue