Randomly use Netty 3 plugin in some tests
When Netty 4 was introduced, it was not the default network implementation. Some tests were constructed to randomly use Netty 4 instead of the default network implementation. When Netty 4 was made the default implementation, these tests were not updated. Thus, these tests are randomly choosing between the default network implementation (Netty 4) and Netty 4. This commit updates these tests to reverse the role of Netty 3 and Netty 4 so that the randomization is choosing between Netty 3 and the default (again, now Netty 4). Relates #20265
This commit is contained in:
parent
5877cb2329
commit
54083f7d6e
|
@ -28,7 +28,6 @@ import org.elasticsearch.action.bulk.BulkResponse;
|
||||||
import org.elasticsearch.action.bulk.Retry;
|
import org.elasticsearch.action.bulk.Retry;
|
||||||
import org.elasticsearch.common.bytes.BytesArray;
|
import org.elasticsearch.common.bytes.BytesArray;
|
||||||
import org.elasticsearch.common.network.NetworkModule;
|
import org.elasticsearch.common.network.NetworkModule;
|
||||||
import org.elasticsearch.common.settings.Setting;
|
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.transport.TransportAddress;
|
import org.elasticsearch.common.transport.TransportAddress;
|
||||||
import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException;
|
import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException;
|
||||||
|
@ -43,7 +42,6 @@ import org.junit.Before;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CyclicBarrier;
|
import java.util.concurrent.CyclicBarrier;
|
||||||
|
|
||||||
|
@ -63,12 +61,12 @@ public class RetryTests extends ESSingleNodeTestCase {
|
||||||
|
|
||||||
private List<CyclicBarrier> blockedExecutors = new ArrayList<>();
|
private List<CyclicBarrier> blockedExecutors = new ArrayList<>();
|
||||||
|
|
||||||
private boolean useNetty4;
|
private boolean useNetty3;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
useNetty4 = randomBoolean();
|
useNetty3 = randomBoolean();
|
||||||
createIndex("source");
|
createIndex("source");
|
||||||
// Build the test data. Don't use indexRandom because that won't work consistently with such small thread pools.
|
// Build the test data. Don't use indexRandom because that won't work consistently with such small thread pools.
|
||||||
BulkRequestBuilder bulk = client().prepareBulk();
|
BulkRequestBuilder bulk = client().prepareBulk();
|
||||||
|
@ -112,9 +110,9 @@ public class RetryTests extends ESSingleNodeTestCase {
|
||||||
settings.put(NetworkModule.HTTP_ENABLED.getKey(), true);
|
settings.put(NetworkModule.HTTP_ENABLED.getKey(), true);
|
||||||
// Whitelist reindexing from the http host we're going to use
|
// Whitelist reindexing from the http host we're going to use
|
||||||
settings.put(TransportReindexAction.REMOTE_CLUSTER_WHITELIST.getKey(), "myself");
|
settings.put(TransportReindexAction.REMOTE_CLUSTER_WHITELIST.getKey(), "myself");
|
||||||
if (useNetty4) {
|
if (useNetty3) {
|
||||||
settings.put(NetworkModule.HTTP_TYPE_KEY, Netty4Plugin.NETTY_HTTP_TRANSPORT_NAME);
|
settings.put(NetworkModule.HTTP_TYPE_KEY, Netty3Plugin.NETTY_HTTP_TRANSPORT_NAME);
|
||||||
settings.put(NetworkModule.TRANSPORT_TYPE_KEY, Netty4Plugin.NETTY_TRANSPORT_NAME);
|
settings.put(NetworkModule.TRANSPORT_TYPE_KEY, Netty3Plugin.NETTY_TRANSPORT_NAME);
|
||||||
}
|
}
|
||||||
return settings.build();
|
return settings.build();
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ import org.elasticsearch.common.transport.TransportAddress;
|
||||||
import org.elasticsearch.env.Environment;
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.plugins.Plugin;
|
import org.elasticsearch.plugins.Plugin;
|
||||||
import org.elasticsearch.transport.MockTcpTransportPlugin;
|
import org.elasticsearch.transport.MockTcpTransportPlugin;
|
||||||
|
import org.elasticsearch.transport.Netty3Plugin;
|
||||||
import org.elasticsearch.transport.Netty4Plugin;
|
import org.elasticsearch.transport.Netty4Plugin;
|
||||||
import org.elasticsearch.transport.client.PreBuiltTransportClient;
|
import org.elasticsearch.transport.client.PreBuiltTransportClient;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
|
@ -91,7 +92,7 @@ public abstract class ESSmokeClientTestCase extends LuceneTestCase {
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
plugins = Collections.emptyList();
|
plugins = Collections.emptyList();
|
||||||
builder.put(NetworkModule.TRANSPORT_TYPE_KEY, Netty4Plugin.NETTY_TRANSPORT_NAME);
|
builder.put(NetworkModule.TRANSPORT_TYPE_KEY, Netty3Plugin.NETTY_TRANSPORT_NAME);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
plugins = Collections.emptyList();
|
plugins = Collections.emptyList();
|
||||||
|
|
Loading…
Reference in New Issue