Upgrade to Netty 4.1.25.Final (#31232)

This commit upgrades us to Netty 4.1.25. This upgrade is more
challenging than past upgrades, all because of a new object cleaner
thread that they have added. This thread requires an additional security
permission (set context class loader, needed to avoid leaks in certain
scenarios). Additionally, there is not a clean way to shutdown this
thread which means that the thread can fail thread leak control during
tests. As such, we have to filter this thread from thread leak control.
This commit is contained in:
Jason Tedor 2018-06-11 16:55:07 -04:00 committed by GitHub
parent cb952bd9ec
commit 563141c6c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
90 changed files with 419 additions and 96 deletions

View File

@ -19,6 +19,7 @@
package org.elasticsearch.index.reindex;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
import org.apache.lucene.util.SetOnce;
import org.elasticsearch.ElasticsearchSecurityException;
import org.elasticsearch.ElasticsearchStatusException;
@ -41,6 +42,7 @@ import org.elasticsearch.common.util.concurrent.ThreadContext;
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
import org.elasticsearch.env.Environment;
import org.elasticsearch.env.NodeEnvironment;
import org.elasticsearch.index.reindex.test.ObjectCleanerThreadThreadFilter;
import org.elasticsearch.plugins.ActionPlugin;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.rest.RestStatus;
@ -64,6 +66,7 @@ import static java.util.Collections.singletonMap;
import static org.elasticsearch.index.reindex.ReindexTestCase.matcher;
import static org.hamcrest.Matchers.containsString;
@ThreadLeakFilters(filters = {ObjectCleanerThreadThreadFilter.class})
public class ReindexFromRemoteWithAuthTests extends ESSingleNodeTestCase {
private TransportAddress address;

View File

@ -19,6 +19,7 @@
package org.elasticsearch.index.reindex;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
import org.elasticsearch.action.ActionFuture;
import org.elasticsearch.action.admin.cluster.node.info.NodeInfo;
import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksResponse;
@ -32,6 +33,7 @@ import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.TransportAddress;
import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.reindex.test.ObjectCleanerThreadThreadFilter;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.threadpool.ThreadPool;
@ -55,6 +57,7 @@ import static org.hamcrest.Matchers.hasSize;
* Integration test for retry behavior. Useful because retrying relies on the way that the
* rest of Elasticsearch throws exceptions and unit tests won't verify that.
*/
@ThreadLeakFilters(filters = {ObjectCleanerThreadThreadFilter.class})
public class RetryTests extends ESIntegTestCase {
private static final int DOC_COUNT = 20;

View File

@ -0,0 +1,32 @@
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.index.reindex.test;
import com.carrotsearch.randomizedtesting.ThreadFilter;
public class ObjectCleanerThreadThreadFilter implements ThreadFilter {
@Override
public boolean reject(final Thread t) {
// TODO: replace with constant from Netty when https://github.com/netty/netty/pull/8014 is integrated
return "ObjectCleanerThread".equals(t.getName());
}
}

View File

@ -34,13 +34,13 @@ compileTestJava.options.compilerArgs << "-Xlint:-cast,-deprecation,-rawtypes,-tr
dependencies {
// network stack
compile "io.netty:netty-buffer:4.1.16.Final"
compile "io.netty:netty-codec:4.1.16.Final"
compile "io.netty:netty-codec-http:4.1.16.Final"
compile "io.netty:netty-common:4.1.16.Final"
compile "io.netty:netty-handler:4.1.16.Final"
compile "io.netty:netty-resolver:4.1.16.Final"
compile "io.netty:netty-transport:4.1.16.Final"
compile "io.netty:netty-buffer:4.1.25.Final"
compile "io.netty:netty-codec:4.1.25.Final"
compile "io.netty:netty-codec-http:4.1.25.Final"
compile "io.netty:netty-common:4.1.25.Final"
compile "io.netty:netty-handler:4.1.25.Final"
compile "io.netty:netty-resolver:4.1.25.Final"
compile "io.netty:netty-transport:4.1.25.Final"
}
dependencyLicenses {
@ -161,6 +161,6 @@ thirdPartyAudit.excludes = [
'org.conscrypt.AllocatedBuffer',
'org.conscrypt.BufferAllocator',
'org.conscrypt.Conscrypt$Engines',
'org.conscrypt.Conscrypt',
'org.conscrypt.HandshakeListener'
]

View File

@ -1 +0,0 @@
63b5fa95c74785e16f2c30ce268bc222e35c8cb5

View File

@ -0,0 +1 @@
f366d0cc87b158ca064d27507127e3cc4eb2f089

View File

@ -1 +0,0 @@
d84a1f21768b7309c2954521cf5a1f46c2309eb1

View File

@ -0,0 +1 @@
3e465c75bead40d06b5b9c0612b37cf77c548887

View File

@ -1 +0,0 @@
d64312378b438dfdad84267c599a053327c6f02a

View File

@ -0,0 +1 @@
70888d3f2a829541378f68503ddd52c3193df35a

View File

@ -1 +0,0 @@
177a6b30cca92f6f5f9873c9befd681377a4c328

View File

@ -0,0 +1 @@
e17d5c05c101fe14536ce3fb34b36c54e04791f6

View File

@ -1 +0,0 @@
fec0e63e7dd7f4eeef7ea8dc47a1ff32dfc7ebc2

View File

@ -0,0 +1 @@
ecdfb8fe93a8b75db3ea8746d3437eed845c24bd

View File

@ -1 +0,0 @@
f6eb553b53fb3a90a8ac1170697093fed82eae28

View File

@ -0,0 +1 @@
dc0965d00746b782b33f419b005cbc130973030d

View File

@ -1 +0,0 @@
3c8ee2c4d4a1cbb947a5c184c7aeb2204260958b

View File

@ -0,0 +1 @@
19a6f1f649894b6705aa9d8cbcced188dff133b0

View File

@ -21,6 +21,8 @@ grant codeBase "${codebase.netty-common}" {
// for reading the system-wide configuration for the backlog of established sockets
permission java.io.FilePermission "/proc/sys/net/core/somaxconn", "read";
permission java.lang.RuntimePermission "setContextClassLoader";
// netty makes and accepts socket connections
permission java.net.SocketPermission "*", "accept,connect";
};

View File

@ -20,6 +20,7 @@
package org.elasticsearch.http.netty4;
import io.netty.handler.codec.http.FullHttpResponse;
import org.elasticsearch.test.Netty4TestCase;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.common.network.NetworkService;
import org.elasticsearch.common.settings.Settings;
@ -33,7 +34,6 @@ import org.elasticsearch.rest.BytesRestResponse;
import org.elasticsearch.rest.RestChannel;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.threadpool.TestThreadPool;
import org.elasticsearch.threadpool.ThreadPool;
import org.junit.After;
@ -48,7 +48,7 @@ import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasSize;
public class Netty4BadRequestTests extends ESTestCase {
public class Netty4BadRequestTests extends Netty4TestCase {
private NetworkService networkService;
private MockBigArrays bigArrays;

View File

@ -41,6 +41,7 @@ import io.netty.handler.codec.http.HttpResponse;
import io.netty.handler.codec.http.HttpVersion;
import io.netty.util.Attribute;
import io.netty.util.AttributeKey;
import org.elasticsearch.test.Netty4TestCase;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.bytes.ReleasablePagedBytesReference;
import org.elasticsearch.common.io.stream.BytesStreamOutput;
@ -64,7 +65,6 @@ import org.elasticsearch.indices.breaker.NoneCircuitBreakerService;
import org.elasticsearch.rest.BytesRestResponse;
import org.elasticsearch.rest.RestResponse;
import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.threadpool.TestThreadPool;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.netty4.Netty4Utils;
@ -90,7 +90,7 @@ import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
public class Netty4HttpChannelTests extends ESTestCase {
public class Netty4HttpChannelTests extends Netty4TestCase {
private NetworkService networkService;
private ThreadPool threadPool;

View File

@ -36,9 +36,9 @@ import io.netty.handler.codec.http.HttpRequest;
import io.netty.handler.codec.http.HttpVersion;
import io.netty.handler.codec.http.LastHttpContent;
import io.netty.handler.codec.http.QueryStringDecoder;
import org.elasticsearch.test.Netty4TestCase;
import org.elasticsearch.common.Randomness;
import org.elasticsearch.http.HttpPipelinedRequest;
import org.elasticsearch.test.ESTestCase;
import org.junit.After;
import java.nio.channels.ClosedChannelException;
@ -61,7 +61,7 @@ import static io.netty.handler.codec.http.HttpResponseStatus.OK;
import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1;
import static org.hamcrest.core.Is.is;
public class Netty4HttpPipeliningHandlerTests extends ESTestCase {
public class Netty4HttpPipeliningHandlerTests extends Netty4TestCase {
private final ExecutorService handlerService = Executors.newFixedThreadPool(randomIntBetween(4, 8));
private final ExecutorService eventLoopService = Executors.newFixedThreadPool(1);

View File

@ -20,7 +20,7 @@
package org.elasticsearch.http.netty4;
import io.netty.handler.codec.http.FullHttpResponse;
import org.elasticsearch.ESNetty4IntegTestCase;
import org.elasticsearch.test.Netty4IntegTestCase;
import org.elasticsearch.common.collect.Tuple;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.TransportAddress;
@ -45,7 +45,7 @@ import static org.hamcrest.Matchers.hasSize;
* a single node "cluster". We also force test infrastructure to use the node client instead of the transport client for the same reason.
*/
@ClusterScope(scope = Scope.TEST, supportsDedicatedMasters = false, numClientNodes = 0, numDataNodes = 1, transportClientRatio = 0)
public class Netty4HttpRequestSizeLimitIT extends ESNetty4IntegTestCase {
public class Netty4HttpRequestSizeLimitIT extends Netty4IntegTestCase {
private static final ByteSizeValue LIMIT = new ByteSizeValue(2, ByteSizeUnit.KB);

View File

@ -32,6 +32,7 @@ import io.netty.handler.codec.http.FullHttpResponse;
import io.netty.handler.codec.http.HttpHeaderNames;
import io.netty.handler.codec.http.HttpResponseStatus;
import io.netty.handler.codec.http.HttpVersion;
import org.elasticsearch.test.Netty4TestCase;
import org.elasticsearch.common.network.NetworkService;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.TransportAddress;
@ -42,7 +43,6 @@ import org.elasticsearch.http.HttpPipelinedRequest;
import org.elasticsearch.http.HttpServerTransport;
import org.elasticsearch.http.NullDispatcher;
import org.elasticsearch.indices.breaker.NoneCircuitBreakerService;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.threadpool.TestThreadPool;
import org.elasticsearch.threadpool.ThreadPool;
import org.junit.After;
@ -61,7 +61,7 @@ import static org.hamcrest.Matchers.contains;
/**
* This test just tests, if he pipelining works in general with out any connection the Elasticsearch handler
*/
public class Netty4HttpServerPipeliningTests extends ESTestCase {
public class Netty4HttpServerPipeliningTests extends Netty4TestCase {
private NetworkService networkService;
private ThreadPool threadPool;
private MockBigArrays bigArrays;

View File

@ -38,6 +38,7 @@ import io.netty.handler.codec.http.HttpMethod;
import io.netty.handler.codec.http.HttpResponseStatus;
import io.netty.handler.codec.http.HttpUtil;
import io.netty.handler.codec.http.HttpVersion;
import org.elasticsearch.test.Netty4TestCase;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.bytes.BytesArray;
@ -59,7 +60,6 @@ import org.elasticsearch.indices.breaker.NoneCircuitBreakerService;
import org.elasticsearch.rest.BytesRestResponse;
import org.elasticsearch.rest.RestChannel;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.threadpool.TestThreadPool;
import org.elasticsearch.threadpool.ThreadPool;
import org.junit.After;
@ -94,7 +94,7 @@ import static org.hamcrest.Matchers.is;
/**
* Tests for the {@link Netty4HttpServerTransport} class.
*/
public class Netty4HttpServerTransportTests extends ESTestCase {
public class Netty4HttpServerTransportTests extends Netty4TestCase {
private NetworkService networkService;
private ThreadPool threadPool;

View File

@ -20,7 +20,7 @@
package org.elasticsearch.http.netty4;
import io.netty.handler.codec.http.FullHttpResponse;
import org.elasticsearch.ESNetty4IntegTestCase;
import org.elasticsearch.test.Netty4IntegTestCase;
import org.elasticsearch.common.transport.TransportAddress;
import org.elasticsearch.http.HttpServerTransport;
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
@ -33,7 +33,7 @@ import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;
@ClusterScope(scope = Scope.TEST, supportsDedicatedMasters = false, numDataNodes = 1)
public class Netty4PipeliningIT extends ESNetty4IntegTestCase {
public class Netty4PipeliningIT extends Netty4IntegTestCase {
@Override
protected boolean addMockHttpTransport() {

View File

@ -16,19 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch;
package org.elasticsearch.test;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
import org.elasticsearch.common.network.NetworkModule;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.transport.Netty4Plugin;
import org.elasticsearch.transport.netty4.Netty4Transport;
import java.util.Arrays;
import java.util.Collection;
public abstract class ESNetty4IntegTestCase extends ESIntegTestCase {
@ThreadLeakFilters(filters = {ObjectCleanerThreadThreadFilter.class})
public abstract class Netty4IntegTestCase extends ESIntegTestCase {
@Override
protected boolean ignoreExternalCluster() {

View File

@ -0,0 +1,26 @@
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.test;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
@ThreadLeakFilters(filters = {ObjectCleanerThreadThreadFilter.class})
public abstract class Netty4TestCase extends ESTestCase {
}

View File

@ -0,0 +1,38 @@
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.test;
import com.carrotsearch.randomizedtesting.ThreadFilter;
/**
* The Netty object cleaner thread is not closeable and it does not terminate in a timely manner. This means that thread leak control in
* tests will fail test suites when the object cleaner thread has not terminated. Since there is not a reliable way to terminate this thread
* we instead filter it out of thread leak control.
*/
public class ObjectCleanerThreadThreadFilter implements ThreadFilter {
@Override
public boolean reject(final Thread t) {
// TODO: replace with constant from Netty when https://github.com/netty/netty/pull/8014 is integrated
return "ObjectCleanerThread".equals(t.getName());
}
}

View File

@ -18,15 +18,18 @@
*/
package org.elasticsearch.transport.netty4;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.apache.lucene.util.BytesRef;
import org.elasticsearch.test.ObjectCleanerThreadThreadFilter;
import org.elasticsearch.common.bytes.AbstractBytesReferenceTestCase;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.io.stream.ReleasableBytesStreamOutput;
import java.io.IOException;
@ThreadLeakFilters(filters = {ObjectCleanerThreadThreadFilter.class})
public class ByteBufBytesReferenceTests extends AbstractBytesReferenceTestCase {
@Override

View File

@ -20,7 +20,7 @@
package org.elasticsearch.transport.netty4;
import org.apache.logging.log4j.Level;
import org.elasticsearch.ESNetty4IntegTestCase;
import org.elasticsearch.test.Netty4IntegTestCase;
import org.elasticsearch.action.admin.cluster.node.hotthreads.NodesHotThreadsRequest;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.test.ESIntegTestCase;
@ -29,7 +29,7 @@ import org.elasticsearch.test.junit.annotations.TestLogging;
@ESIntegTestCase.ClusterScope(numDataNodes = 2)
@TestLogging(value = "org.elasticsearch.transport.netty4.ESLoggingHandler:trace")
public class ESLoggingHandlerIT extends ESNetty4IntegTestCase {
public class ESLoggingHandlerIT extends Netty4IntegTestCase {
private MockLogAppender appender;

View File

@ -18,6 +18,7 @@
*/
package org.elasticsearch.transport.netty4;
import org.elasticsearch.test.Netty4TestCase;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.lease.Releasables;
@ -26,7 +27,6 @@ import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.BigArrays;
import org.elasticsearch.indices.breaker.CircuitBreakerService;
import org.elasticsearch.indices.breaker.NoneCircuitBreakerService;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.test.transport.MockTransportService;
import org.elasticsearch.threadpool.TestThreadPool;
import org.elasticsearch.threadpool.ThreadPool;
@ -47,7 +47,7 @@ import java.util.Collections;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
public class Netty4ScheduledPingTests extends ESTestCase {
public class Netty4ScheduledPingTests extends Netty4TestCase {
public void testScheduledPing() throws Exception {
ThreadPool threadPool = new TestThreadPool(getClass().getName());

View File

@ -19,6 +19,7 @@
package org.elasticsearch.transport.netty4;
import org.elasticsearch.test.Netty4TestCase;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.network.NetworkService;
import org.elasticsearch.common.settings.Settings;
@ -28,7 +29,6 @@ import org.elasticsearch.common.util.MockBigArrays;
import org.elasticsearch.common.util.MockPageCacheRecycler;
import org.elasticsearch.indices.breaker.NoneCircuitBreakerService;
import org.elasticsearch.mocksocket.MockSocket;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.TcpTransport;
import org.junit.After;
@ -47,7 +47,7 @@ import static org.hamcrest.Matchers.is;
* This test checks, if a HTTP look-alike request (starting with a HTTP method and a space)
* actually returns text response instead of just dropping the connection
*/
public class Netty4SizeHeaderFrameDecoderTests extends ESTestCase {
public class Netty4SizeHeaderFrameDecoderTests extends Netty4TestCase {
private final Settings settings = Settings.builder()
.put("node.name", "NettySizeHeaderFrameDecoderTests")

View File

@ -18,7 +18,7 @@
*/
package org.elasticsearch.transport.netty4;
import org.elasticsearch.ESNetty4IntegTestCase;
import org.elasticsearch.test.Netty4IntegTestCase;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.Version;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
@ -54,7 +54,7 @@ import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is;
@ClusterScope(scope = Scope.TEST, supportsDedicatedMasters = false, numDataNodes = 1)
public class Netty4TransportIT extends ESNetty4IntegTestCase {
public class Netty4TransportIT extends Netty4IntegTestCase {
// static so we can use it in anonymous classes
private static String channelProfileName = null;

View File

@ -18,7 +18,7 @@
*/
package org.elasticsearch.transport.netty4;
import org.elasticsearch.ESNetty4IntegTestCase;
import org.elasticsearch.test.Netty4IntegTestCase;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.action.admin.cluster.node.info.NodeInfo;
import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse;
@ -48,7 +48,7 @@ import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.lessThanOrEqualTo;
@ClusterScope(scope = Scope.SUITE, supportsDedicatedMasters = false, numDataNodes = 1, numClientNodes = 0)
public class Netty4TransportMultiPortIntegrationIT extends ESNetty4IntegTestCase {
public class Netty4TransportMultiPortIntegrationIT extends Netty4IntegTestCase {
private static int randomPort = -1;
private static String randomPortRange;

View File

@ -19,7 +19,7 @@
package org.elasticsearch.transport.netty4;
import org.elasticsearch.ESNetty4IntegTestCase;
import org.elasticsearch.test.Netty4IntegTestCase;
import org.elasticsearch.action.admin.cluster.node.info.NodeInfo;
import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse;
import org.elasticsearch.common.network.NetworkModule;
@ -41,7 +41,7 @@ import static org.hamcrest.Matchers.instanceOf;
* different ports on ipv4 and ipv6.
*/
@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, numDataNodes = 0)
public class Netty4TransportPublishAddressIT extends ESNetty4IntegTestCase {
public class Netty4TransportPublishAddressIT extends Netty4IntegTestCase {
@Override
protected Settings nodeSettings(int nodeOrdinal) {
return Settings.builder()

View File

@ -18,6 +18,7 @@
*/
package org.elasticsearch.transport.netty4;
import org.elasticsearch.test.Netty4TestCase;
import org.elasticsearch.common.component.Lifecycle;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.network.NetworkService;
@ -27,7 +28,6 @@ import org.elasticsearch.common.util.BigArrays;
import org.elasticsearch.common.util.MockBigArrays;
import org.elasticsearch.common.util.MockPageCacheRecycler;
import org.elasticsearch.indices.breaker.NoneCircuitBreakerService;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.threadpool.TestThreadPool;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.TcpTransport;
@ -37,7 +37,7 @@ import java.util.Collections;
import static org.hamcrest.Matchers.is;
public class NettyTransportMultiPortTests extends ESTestCase {
public class NettyTransportMultiPortTests extends Netty4TestCase {
private String host;

View File

@ -19,6 +19,8 @@
package org.elasticsearch.transport.netty4;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
import org.elasticsearch.test.ObjectCleanerThreadThreadFilter;
import org.elasticsearch.Version;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
@ -49,6 +51,7 @@ import static java.util.Collections.emptyMap;
import static java.util.Collections.emptySet;
import static org.hamcrest.Matchers.containsString;
@ThreadLeakFilters(filters = {ObjectCleanerThreadThreadFilter.class})
public class SimpleNetty4TransportTests extends AbstractSimpleTransportTestCase {
public static MockTransportService nettyFromThreadPool(Settings settings, ThreadPool threadPool, final Version version,

View File

@ -29,13 +29,13 @@ dependencies {
compile "org.elasticsearch:elasticsearch-nio:${version}"
// network stack
compile "io.netty:netty-buffer:4.1.16.Final"
compile "io.netty:netty-codec:4.1.16.Final"
compile "io.netty:netty-codec-http:4.1.16.Final"
compile "io.netty:netty-common:4.1.16.Final"
compile "io.netty:netty-handler:4.1.16.Final"
compile "io.netty:netty-resolver:4.1.16.Final"
compile "io.netty:netty-transport:4.1.16.Final"
compile "io.netty:netty-buffer:4.1.25.Final"
compile "io.netty:netty-codec:4.1.25.Final"
compile "io.netty:netty-codec-http:4.1.25.Final"
compile "io.netty:netty-common:4.1.25.Final"
compile "io.netty:netty-handler:4.1.25.Final"
compile "io.netty:netty-resolver:4.1.25.Final"
compile "io.netty:netty-transport:4.1.25.Final"
}
dependencyLicenses {
@ -140,6 +140,6 @@ thirdPartyAudit.excludes = [
'org.conscrypt.AllocatedBuffer',
'org.conscrypt.BufferAllocator',
'org.conscrypt.Conscrypt$Engines',
'org.conscrypt.Conscrypt',
'org.conscrypt.HandshakeListener'
]

View File

@ -1 +0,0 @@
63b5fa95c74785e16f2c30ce268bc222e35c8cb5

View File

@ -0,0 +1 @@
f366d0cc87b158ca064d27507127e3cc4eb2f089

View File

@ -1 +0,0 @@
d84a1f21768b7309c2954521cf5a1f46c2309eb1

View File

@ -0,0 +1 @@
3e465c75bead40d06b5b9c0612b37cf77c548887

View File

@ -1 +0,0 @@
d64312378b438dfdad84267c599a053327c6f02a

View File

@ -0,0 +1 @@
70888d3f2a829541378f68503ddd52c3193df35a

View File

@ -1 +0,0 @@
177a6b30cca92f6f5f9873c9befd681377a4c328

View File

@ -0,0 +1 @@
e17d5c05c101fe14536ce3fb34b36c54e04791f6

View File

@ -1 +0,0 @@
fec0e63e7dd7f4eeef7ea8dc47a1ff32dfc7ebc2

View File

@ -0,0 +1 @@
ecdfb8fe93a8b75db3ea8746d3437eed845c24bd

View File

@ -1 +0,0 @@
f6eb553b53fb3a90a8ac1170697093fed82eae28

View File

@ -0,0 +1 @@
dc0965d00746b782b33f419b005cbc130973030d

View File

@ -1 +0,0 @@
3c8ee2c4d4a1cbb947a5c184c7aeb2204260958b

View File

@ -0,0 +1 @@
19a6f1f649894b6705aa9d8cbcced188dff133b0

View File

@ -23,6 +23,8 @@ grant codeBase "${codebase.elasticsearch-nio}" {
};
grant codeBase "${codebase.netty-common}" {
permission java.lang.RuntimePermission "setContextClassLoader";
// This should only currently be required as we use the netty http client for tests
// netty makes and accepts socket connections
permission java.net.SocketPermission "*", "accept,connect";

View File

@ -46,7 +46,7 @@ import org.elasticsearch.nio.NioSocketChannel;
import org.elasticsearch.nio.SocketChannelContext;
import org.elasticsearch.rest.RestChannel;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.test.NioHttpTestCase;
import org.junit.Before;
import org.mockito.ArgumentCaptor;
@ -69,7 +69,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
public class HttpReadWriteHandlerTests extends ESTestCase {
public class HttpReadWriteHandlerTests extends NioHttpTestCase {
private HttpReadWriteHandler handler;
private NioSocketChannel nioSocketChannel;

View File

@ -27,14 +27,14 @@ import io.netty.channel.ChannelOutboundHandlerAdapter;
import io.netty.channel.ChannelPromise;
import io.netty.channel.SimpleChannelInboundHandler;
import org.elasticsearch.nio.FlushOperation;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.test.NioHttpTestCase;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.Locale;
import java.util.concurrent.atomic.AtomicBoolean;
public class NettyAdaptorTests extends ESTestCase {
public class NettyAdaptorTests extends NioHttpTestCase {
public void testBasicRead() {
TenIntsToStringsHandler handler = new TenIntsToStringsHandler();

View File

@ -38,7 +38,7 @@ import io.netty.handler.codec.http.LastHttpContent;
import io.netty.handler.codec.http.QueryStringDecoder;
import org.elasticsearch.common.Randomness;
import org.elasticsearch.http.HttpPipelinedRequest;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.test.NioHttpTestCase;
import org.junit.After;
import java.nio.channels.ClosedChannelException;
@ -61,7 +61,7 @@ import static io.netty.handler.codec.http.HttpResponseStatus.OK;
import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1;
import static org.hamcrest.core.Is.is;
public class NioHttpPipeliningHandlerTests extends ESTestCase {
public class NioHttpPipeliningHandlerTests extends NioHttpTestCase {
private final ExecutorService handlerService = Executors.newFixedThreadPool(randomIntBetween(4, 8));
private final ExecutorService eventLoopService = Executors.newFixedThreadPool(1);

View File

@ -51,7 +51,7 @@ import org.elasticsearch.indices.breaker.NoneCircuitBreakerService;
import org.elasticsearch.rest.BytesRestResponse;
import org.elasticsearch.rest.RestChannel;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.test.NioHttpTestCase;
import org.elasticsearch.threadpool.TestThreadPool;
import org.elasticsearch.threadpool.ThreadPool;
import org.junit.After;
@ -83,7 +83,7 @@ import static org.hamcrest.Matchers.is;
/**
* Tests for the {@link NioHttpServerTransport} class.
*/
public class NioHttpServerTransportTests extends ESTestCase {
public class NioHttpServerTransportTests extends NioHttpTestCase {
private NetworkService networkService;
private ThreadPool threadPool;

View File

@ -20,11 +20,11 @@
package org.elasticsearch.http.nio;
import io.netty.handler.codec.http.FullHttpResponse;
import org.elasticsearch.NioIntegTestCase;
import org.elasticsearch.common.transport.TransportAddress;
import org.elasticsearch.http.HttpServerTransport;
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
import org.elasticsearch.test.ESIntegTestCase.Scope;
import org.elasticsearch.test.NioHttpIntegTestCase;
import java.util.Collection;
import java.util.Locale;
@ -33,7 +33,7 @@ import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;
@ClusterScope(scope = Scope.TEST, supportsDedicatedMasters = false, numDataNodes = 1)
public class NioPipeliningIT extends NioIntegTestCase {
public class NioPipeliningIT extends NioHttpIntegTestCase {
@Override
protected boolean addMockHttpTransport() {

View File

@ -0,0 +1,26 @@
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.test;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
@ThreadLeakFilters(filters = {ObjectCleanerThreadThreadFilter.class})
public abstract class NioHttpIntegTestCase extends NioIntegTestCase {
}

View File

@ -0,0 +1,26 @@
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.test;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
@ThreadLeakFilters(filters = {ObjectCleanerThreadThreadFilter.class})
public abstract class NioHttpTestCase extends ESTestCase {
}

View File

@ -16,13 +16,12 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch;
package org.elasticsearch.test;
import org.elasticsearch.common.network.NetworkModule;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.http.nio.NioHttpServerTransport;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.transport.nio.NioTransport;
import org.elasticsearch.transport.nio.NioTransportPlugin;

View File

@ -0,0 +1,38 @@
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.test;
import com.carrotsearch.randomizedtesting.ThreadFilter;
/**
* The Netty object cleaner thread is not closeable and it does not terminate in a timely manner. This means that thread leak control in
* tests will fail test suites when the object cleaner thread has not terminated. Since there is not a reliable way to terminate this thread
* we instead filter it out of thread leak control.
*/
public class ObjectCleanerThreadThreadFilter implements ThreadFilter {
@Override
public boolean reject(final Thread t) {
// TODO: replace with constant from Netty when https://github.com/netty/netty/pull/8014 is integrated
return "ObjectCleanerThread".equals(t.getName());
}
}

View File

@ -19,7 +19,6 @@
package org.elasticsearch.transport.nio;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.NioIntegTestCase;
import org.elasticsearch.Version;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.client.Client;
@ -36,6 +35,7 @@ import org.elasticsearch.plugins.NetworkPlugin;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
import org.elasticsearch.test.ESIntegTestCase.Scope;
import org.elasticsearch.test.NioIntegTestCase;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.TcpChannel;
import org.elasticsearch.transport.TcpTransport;

View File

@ -19,6 +19,8 @@
package org.elasticsearch.smoketest;
import com.carrotsearch.randomizedtesting.ThreadFilter;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
import org.apache.logging.log4j.Logger;
import org.apache.lucene.util.LuceneTestCase;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
@ -62,8 +64,24 @@ import static org.hamcrest.Matchers.notNullValue;
* then run JUnit. If you changed the default port, set "-Dtests.cluster=localhost:PORT" when running your test.
*/
@LuceneTestCase.SuppressSysoutChecks(bugUrl = "we log a lot on purpose")
@ThreadLeakFilters(filters = {ESSmokeClientTestCase.ObjectCleanerThreadThreadFilter.class})
public abstract class ESSmokeClientTestCase extends LuceneTestCase {
/**
* The Netty object cleaner thread is not closeable and it does not terminate in a timely manner. This means that thread leak control in
* tests will fail test suites when the object cleaner thread has not terminated. Since there is not a reliable way to terminate this
* thread we instead filter it out of thread leak control.
*/
public static class ObjectCleanerThreadThreadFilter implements ThreadFilter {
@Override
public boolean reject(final Thread t) {
// TODO: replace with constant from Netty when https://github.com/netty/netty/pull/8014 is integrated
return "ObjectCleanerThread".equals(t.getName());
}
}
/**
* Key used to eventually switch to using an external cluster and provide its transport addresses
*/

View File

@ -18,10 +18,13 @@
*/
package org.elasticsearch.http;
import com.carrotsearch.randomizedtesting.ThreadFilter;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
import org.elasticsearch.common.network.NetworkModule;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.transport.MockTcpTransportPlugin;
import org.elasticsearch.transport.Netty4Plugin;
import org.elasticsearch.transport.nio.MockNioTransportPlugin;
@ -31,8 +34,19 @@ import org.junit.BeforeClass;
import java.util.Arrays;
import java.util.Collection;
@ThreadLeakFilters(filters = {HttpSmokeTestCase.ObjectCleanerThreadThreadFilter.class})
public abstract class HttpSmokeTestCase extends ESIntegTestCase {
public static class ObjectCleanerThreadThreadFilter implements ThreadFilter {
@Override
public boolean reject(final Thread t) {
// TODO: replace with constant from Netty when https://github.com/netty/netty/pull/8014 is integrated
return "ObjectCleanerThread".equals(t.getName());
}
}
private static String nodeTransportTypeKey;
private static String nodeHttpTypeKey;
private static String clientTypeKey;

View File

@ -15,6 +15,8 @@ grant {
grant codeBase "${codebase.netty-common}" {
// for reading the system-wide configuration for the backlog of established sockets
permission java.io.FilePermission "/proc/sys/net/core/somaxconn", "read";
permission java.lang.RuntimePermission "setContextClassLoader";
};
grant codeBase "${codebase.netty-transport}" {

View File

@ -3,6 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.license;
import org.elasticsearch.analysis.common.CommonAnalysisPlugin;
@ -13,16 +14,16 @@ import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.xpack.core.LocalStateCompositeXPackPlugin;
import org.elasticsearch.xpack.core.XPackClientPlugin;
import org.elasticsearch.xpack.core.XPackSettings;
import org.elasticsearch.xpack.core.test.XPackIntegTestCase;
import java.util.Arrays;
import java.util.Collection;
import java.util.concurrent.CountDownLatch;
public abstract class AbstractLicensesIntegrationTestCase extends ESIntegTestCase {
public abstract class AbstractLicensesIntegrationTestCase extends XPackIntegTestCase {
@Override
protected Settings nodeSettings(int nodeOrdinal) {

View File

@ -3,6 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.license;
import org.elasticsearch.client.Response;

View File

@ -0,0 +1,24 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.core.test;
import com.carrotsearch.randomizedtesting.ThreadFilter;
/**
* The Netty object cleaner thread is not closeable and it does not terminate in a timely manner. This means that thread leak control in
* tests will fail test suites when the object cleaner thread has not terminated. Since there is not a reliable way to terminate this
* thread we instead filter it out of thread leak control.
*/
public class ObjectCleanerThreadThreadFilter implements ThreadFilter {
@Override
public boolean reject(final Thread t) {
// TODO: replace with constant from Netty when https://github.com/netty/netty/pull/8014 is integrated
return "ObjectCleanerThread".equals(t.getName());
}
}

View File

@ -0,0 +1,14 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.core.test;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
import org.elasticsearch.test.ESIntegTestCase;
@ThreadLeakFilters(filters = {ObjectCleanerThreadThreadFilter.class})
public abstract class XPackIntegTestCase extends ESIntegTestCase {
}

View File

@ -0,0 +1,14 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.core.test;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
import org.elasticsearch.test.ESSingleNodeTestCase;
@ThreadLeakFilters(filters = {ObjectCleanerThreadThreadFilter.class})
public abstract class XPackSingleNodeTestCase extends ESSingleNodeTestCase {
}

View File

@ -27,19 +27,17 @@ import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.test.MockHttpTransport;
import org.elasticsearch.test.discovery.TestZenDiscovery;
import org.elasticsearch.xpack.core.XPackSettings;
import org.elasticsearch.xpack.core.ml.action.GetDatafeedsAction;
import org.elasticsearch.xpack.core.ml.action.GetJobsAction;
import org.elasticsearch.xpack.core.ml.action.util.QueryPage;
import org.elasticsearch.xpack.core.ml.client.MachineLearningClient;
import org.elasticsearch.xpack.ml.LocalStateMachineLearning;
import org.elasticsearch.xpack.ml.MachineLearning;
import org.elasticsearch.xpack.core.ml.MachineLearningField;
import org.elasticsearch.xpack.core.ml.action.CloseJobAction;
import org.elasticsearch.xpack.core.ml.action.DeleteDatafeedAction;
import org.elasticsearch.xpack.core.ml.action.DeleteJobAction;
import org.elasticsearch.xpack.core.ml.action.GetDatafeedsAction;
import org.elasticsearch.xpack.core.ml.action.GetDatafeedsStatsAction;
import org.elasticsearch.xpack.core.ml.action.GetJobsAction;
import org.elasticsearch.xpack.core.ml.action.GetJobsStatsAction;
import org.elasticsearch.xpack.core.ml.action.StopDatafeedAction;
import org.elasticsearch.xpack.core.ml.action.util.QueryPage;
import org.elasticsearch.xpack.core.ml.client.MachineLearningClient;
import org.elasticsearch.xpack.core.ml.datafeed.DatafeedConfig;
import org.elasticsearch.xpack.core.ml.datafeed.DatafeedState;
import org.elasticsearch.xpack.core.ml.job.config.AnalysisConfig;
@ -49,6 +47,9 @@ import org.elasticsearch.xpack.core.ml.job.config.Detector;
import org.elasticsearch.xpack.core.ml.job.config.Job;
import org.elasticsearch.xpack.core.ml.job.config.JobState;
import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.DataCounts;
import org.elasticsearch.xpack.core.test.XPackIntegTestCase;
import org.elasticsearch.xpack.ml.LocalStateMachineLearning;
import org.elasticsearch.xpack.ml.MachineLearning;
import org.junit.After;
import org.junit.Before;
@ -69,7 +70,7 @@ import static org.hamcrest.Matchers.equalTo;
*/
@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, numDataNodes = 0, numClientNodes = 0,
transportClientRatio = 0, supportsDedicatedMasters = false)
public abstract class BaseMlIntegTestCase extends ESIntegTestCase {
public abstract class BaseMlIntegTestCase extends XPackIntegTestCase {
@Override
protected boolean ignoreExternalCluster() {

View File

@ -23,6 +23,8 @@ grant codeBase "${codebase.xmlsec-2.0.8.jar}" {
grant codeBase "${codebase.netty-common}" {
// for reading the system-wide configuration for the backlog of established sockets
permission java.io.FilePermission "/proc/sys/net/core/somaxconn", "read";
permission java.lang.RuntimePermission "setContextClassLoader";
};
grant codeBase "${codebase.netty-transport}" {

View File

@ -3,6 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.test;
import io.netty.util.ThreadDeathWatcher;
@ -41,8 +42,8 @@ import org.elasticsearch.xpack.core.XPackSettings;
import org.elasticsearch.xpack.core.security.SecurityField;
import org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken;
import org.elasticsearch.xpack.core.security.client.SecurityClient;
import org.elasticsearch.xpack.core.test.XPackIntegTestCase;
import org.elasticsearch.xpack.security.LocalStateSecurity;
import org.elasticsearch.xpack.security.support.SecurityIndexManager;
import org.junit.AfterClass;
import org.junit.Before;
@ -75,7 +76,7 @@ import static org.hamcrest.core.IsCollectionContaining.hasItem;
*
* @see SecuritySettingsSource
*/
public abstract class SecurityIntegTestCase extends ESIntegTestCase {
public abstract class SecurityIntegTestCase extends XPackIntegTestCase {
private static SecuritySettingsSource SECURITY_DEFAULT_SETTINGS;
protected static SecureString BOOTSTRAP_PASSWORD = null;

View File

@ -3,6 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.test;
import io.netty.util.ThreadDeathWatcher;
@ -22,6 +23,7 @@ import org.elasticsearch.core.internal.io.IOUtils;
import org.elasticsearch.license.LicenseService;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.plugins.PluginInfo;
import org.elasticsearch.xpack.core.test.XPackSingleNodeTestCase;
import org.elasticsearch.xpack.security.LocalStateSecurity;
import org.junit.AfterClass;
import org.junit.Before;
@ -49,7 +51,7 @@ import static org.hamcrest.core.IsCollectionContaining.hasItem;
* {@link SecurityIntegTestCase} due to simplicity and improved speed from not needing to start
* multiple nodes and wait for the cluster to form.
*/
public abstract class SecuritySingleNodeTestCase extends ESSingleNodeTestCase {
public abstract class SecuritySingleNodeTestCase extends XPackSingleNodeTestCase {
private static SecuritySettingsSource SECURITY_DEFAULT_SETTINGS = null;
private static CustomSecuritySettingsSource customSecuritySettingsSource = null;

View File

@ -31,7 +31,6 @@ import org.elasticsearch.script.MockMustacheScriptEngine;
import org.elasticsearch.script.Script;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
import org.elasticsearch.test.InternalTestCluster;
import org.elasticsearch.test.disruption.ServiceDisruptionScheme;
@ -40,6 +39,7 @@ import org.elasticsearch.test.transport.MockTransportService;
import org.elasticsearch.xpack.core.XPackClient;
import org.elasticsearch.xpack.core.XPackSettings;
import org.elasticsearch.xpack.core.security.SecurityField;
import org.elasticsearch.xpack.core.test.XPackIntegTestCase;
import org.elasticsearch.xpack.core.watcher.WatcherState;
import org.elasticsearch.xpack.core.watcher.client.WatcherClient;
import org.elasticsearch.xpack.core.watcher.execution.ExecutionState;
@ -94,7 +94,7 @@ import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNot.not;
@ClusterScope(scope = SUITE, numClientNodes = 0, transportClientRatio = 0, maxNumDataNodes = 3)
public abstract class AbstractWatcherIntegrationTestCase extends ESIntegTestCase {
public abstract class AbstractWatcherIntegrationTestCase extends XPackIntegTestCase {
public static final String WATCHER_LANG = Script.DEFAULT_SCRIPT_LANG;

View File

@ -6,6 +6,7 @@
package org.elasticsearch.xpack.security.audit;
import com.carrotsearch.hppc.cursors.ObjectCursor;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
import org.apache.http.message.BasicHeader;
import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateResponse;
import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse;
@ -24,8 +25,9 @@ import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.test.TestCluster;
import org.elasticsearch.xpack.core.XPackClientPlugin;
import org.elasticsearch.xpack.core.security.SecurityField;
import org.elasticsearch.xpack.security.audit.index.IndexAuditTrail;
import org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken;
import org.elasticsearch.xpack.core.test.ObjectCleanerThreadThreadFilter;
import org.elasticsearch.xpack.security.audit.index.IndexAuditTrail;
import java.io.IOException;
import java.net.InetSocketAddress;
@ -38,6 +40,7 @@ import java.util.concurrent.atomic.AtomicReference;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.is;
@ThreadLeakFilters(filters = {ObjectCleanerThreadThreadFilter.class})
public class IndexAuditIT extends ESIntegTestCase {
private static final String USER = "test_user";
private static final String PASS = "x-pack-test-password";

View File

@ -5,6 +5,7 @@
*/
package org.elasticsearch.xpack.ml.integration;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.Client;
@ -34,6 +35,7 @@ import org.elasticsearch.search.sort.SortBuilders;
import org.elasticsearch.search.sort.SortOrder;
import org.elasticsearch.tasks.Task;
import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.test.SecuritySettingsSourceField;
import org.elasticsearch.transport.Netty4Plugin;
import org.elasticsearch.xpack.core.LocalStateCompositeXPackPlugin;
@ -84,6 +86,7 @@ import org.elasticsearch.xpack.core.ml.job.results.ForecastRequestStats;
import org.elasticsearch.xpack.core.ml.job.results.Result;
import org.elasticsearch.xpack.core.security.SecurityField;
import org.elasticsearch.xpack.core.security.authc.TokenMetaData;
import org.elasticsearch.xpack.core.test.ObjectCleanerThreadThreadFilter;
import java.io.IOException;
import java.net.URISyntaxException;
@ -107,6 +110,7 @@ import static org.hamcrest.Matchers.notNullValue;
/**
* Base class of ML integration tests that use a native autodetect process
*/
@ThreadLeakFilters(filters = {ObjectCleanerThreadThreadFilter.class})
abstract class MlNativeAutodetectIntegTestCase extends ESIntegTestCase {
private List<Job.Builder> jobs = new ArrayList<>();

View File

@ -3,6 +3,7 @@ apply plugin: 'elasticsearch.rest-test'
dependencies {
testCompile project(path: xpackModule('core'), configuration: 'runtime')
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts')
testCompile project(path: xpackProject('transport-client').path, configuration: 'runtime')
}

View File

@ -5,6 +5,7 @@
*/
package org.elasticsearch.xpack.security.qa;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
import org.elasticsearch.ElasticsearchSecurityException;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.action.admin.cluster.node.info.NodeInfo;
@ -15,10 +16,11 @@ import org.elasticsearch.common.settings.SecureString;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.TransportAddress;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.xpack.core.XPackClientPlugin;
import org.elasticsearch.xpack.client.PreBuiltXPackTransportClient;
import org.elasticsearch.xpack.core.XPackClientPlugin;
import org.elasticsearch.xpack.core.security.SecurityField;
import org.elasticsearch.xpack.core.test.ObjectCleanerThreadThreadFilter;
import org.elasticsearch.xpack.core.test.XPackIntegTestCase;
import java.util.Collection;
import java.util.Collections;
@ -32,7 +34,9 @@ import static org.hamcrest.Matchers.is;
/**
* Integration tests that test a transport client with security being loaded that connect to an external cluster
*/
public class SecurityTransportClientIT extends ESIntegTestCase {
@ThreadLeakFilters(filters = {ObjectCleanerThreadThreadFilter.class})
public class SecurityTransportClientIT extends XPackIntegTestCase {
static final String ADMIN_USER_PW = "test_user:x-pack-test-password";
static final String TRANSPORT_USER_PW = "transport:x-pack-test-password";

View File

@ -9,6 +9,7 @@ esplugin {
dependencies {
compileOnly project(path: xpackModule('core'), configuration: 'runtime')
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts')
testCompile project(path: xpackProject('transport-client').path, configuration: 'runtime')
}

View File

@ -3,6 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.example.realm;
import org.apache.http.message.BasicHeader;
@ -19,9 +20,9 @@ import org.elasticsearch.common.transport.TransportAddress;
import org.elasticsearch.common.util.concurrent.ThreadContext;
import org.elasticsearch.env.Environment;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.xpack.client.PreBuiltXPackTransportClient;
import org.elasticsearch.xpack.core.XPackClientPlugin;
import org.elasticsearch.xpack.core.test.XPackIntegTestCase;
import java.util.Collection;
import java.util.Collections;
@ -32,7 +33,7 @@ import static org.hamcrest.Matchers.is;
/**
* Integration test to test authentication with the custom realm
*/
public class CustomRealmIT extends ESIntegTestCase {
public class CustomRealmIT extends XPackIntegTestCase {
@Override
protected Settings externalClusterClientSettings() {

View File

@ -18,6 +18,7 @@ import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.xpack.core.XPackClientPlugin;
import org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken;
import org.elasticsearch.xpack.core.security.client.SecurityClient;
import org.elasticsearch.xpack.core.test.XPackIntegTestCase;
import java.util.Collection;
import java.util.Collections;
@ -31,7 +32,7 @@ import static org.hamcrest.Matchers.is;
/**
* Integration test for custom roles providers.
*/
public class CustomRolesProviderIT extends ESIntegTestCase {
public class CustomRolesProviderIT extends XPackIntegTestCase {
private static final String TEST_USER = "test_user";
private static final String TEST_PWD = "change_me";

View File

@ -3,6 +3,7 @@ apply plugin: 'elasticsearch.rest-test'
dependencies {
testCompile project(path: xpackModule('core'), configuration: 'runtime')
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts')
testCompile project(path: xpackModule('security'), configuration: 'runtime')
testCompile project(path: xpackProject('transport-client').path, configuration: 'runtime')
}

View File

@ -5,6 +5,7 @@
*/
package org.elasticsearch.xpack.security;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
import org.apache.logging.log4j.Logger;
import org.apache.lucene.util.LuceneTestCase;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
@ -13,8 +14,10 @@ import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.logging.ESLoggerFactory;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.TransportAddress;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.xpack.client.PreBuiltXPackTransportClient;
import org.elasticsearch.xpack.core.security.SecurityField;
import org.elasticsearch.xpack.core.test.ObjectCleanerThreadThreadFilter;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
@ -40,6 +43,7 @@ import static org.hamcrest.Matchers.notNullValue;
* then run JUnit. If you changed the default port, set "tests.cluster=localhost:PORT" when running
* your test.
*/
@ThreadLeakFilters(filters = {ObjectCleanerThreadThreadFilter.class})
@LuceneTestCase.SuppressSysoutChecks(bugUrl = "we log a lot on purpose")
public abstract class MigrateToolTestCase extends LuceneTestCase {

View File

@ -16,6 +16,7 @@ apply plugin: 'elasticsearch.rest-test'
dependencies {
testCompile project(path: xpackModule('core'), configuration: 'runtime')
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts')
}
String outputDir = "${buildDir}/generated-resources/${project.name}"

View File

@ -17,6 +17,7 @@ import org.elasticsearch.xpack.core.action.XPackUsageRequestBuilder;
import org.elasticsearch.xpack.core.action.XPackUsageResponse;
import org.elasticsearch.xpack.core.monitoring.MonitoringFeatureSetUsage;
import org.elasticsearch.xpack.core.security.SecurityField;
import org.elasticsearch.xpack.core.test.XPackIntegTestCase;
import org.junit.After;
import org.junit.Before;
@ -41,7 +42,7 @@ import static org.hamcrest.Matchers.is;
* then uses a transport client to check that the data have been correctly received and
* indexed in the cluster.
*/
public class SmokeTestMonitoringWithSecurityIT extends ESIntegTestCase {
public class SmokeTestMonitoringWithSecurityIT extends XPackIntegTestCase {
private static final String USER = "test_user";
private static final String PASS = "x-pack-test-password";
private static final String MONITORING_PATTERN = ".monitoring-*";

View File

@ -3,6 +3,7 @@ apply plugin: 'elasticsearch.rest-test'
dependencies {
testCompile project(path: xpackModule('core'), configuration: 'runtime')
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts')
testCompile project(path: xpackProject('transport-client').path, configuration: 'runtime')
}

View File

@ -5,6 +5,7 @@
*/
package org.elasticsearch.xpack.ml.client;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
import org.apache.logging.log4j.Logger;
import org.apache.lucene.util.LuceneTestCase;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
@ -15,6 +16,7 @@ import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.TransportAddress;
import org.elasticsearch.env.Environment;
import org.elasticsearch.xpack.client.PreBuiltXPackTransportClient;
import org.elasticsearch.xpack.core.test.ObjectCleanerThreadThreadFilter;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
@ -46,6 +48,7 @@ import static org.hamcrest.Matchers.notNullValue;
* test.
*/
@LuceneTestCase.SuppressSysoutChecks(bugUrl = "we log a lot on purpose")
@ThreadLeakFilters(filters = {ObjectCleanerThreadThreadFilter.class})
public abstract class ESXPackSmokeClientTestCase extends LuceneTestCase {
/**