You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2018/11/30 18:10:38 UTC
[11/17] lucene-solr:branch_7x: SOLR-12801: Make massive improvements
to the tests.
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/eb652b84/solr/core/src/test/org/apache/solr/cloud/MultiThreadedOCPTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/MultiThreadedOCPTest.java b/solr/core/src/test/org/apache/solr/cloud/MultiThreadedOCPTest.java
index 7621c02..d43e1dc 100644
--- a/solr/core/src/test/org/apache/solr/cloud/MultiThreadedOCPTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/MultiThreadedOCPTest.java
@@ -51,7 +51,7 @@ public class MultiThreadedOCPTest extends AbstractFullDistribZkTestBase {
private static final int REQUEST_STATUS_TIMEOUT = 5 * 60;
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
- private static final int NUM_COLLECTIONS = 4;
+ private static final int NUM_COLLECTIONS = 3;
public MultiThreadedOCPTest() {
sliceCount = 2;
@@ -60,7 +60,7 @@ public class MultiThreadedOCPTest extends AbstractFullDistribZkTestBase {
@Test
// commented 20-July-2018 @BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028")
//commented 20-Sep-2018 @BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") // added 17-Aug-2018
- @ShardsFixed(num = 4)
+ @ShardsFixed(num = 3)
public void test() throws Exception {
testParallelCollectionAPICalls();
testTaskExclusivity();
@@ -119,7 +119,7 @@ public class MultiThreadedOCPTest extends AbstractFullDistribZkTestBase {
private void testParallelCollectionAPICalls() throws IOException, SolrServerException {
try (SolrClient client = createNewSolrClient("", getBaseUrl((HttpSolrClient) clients.get(0)))) {
for(int i = 1 ; i <= NUM_COLLECTIONS ; i++) {
- CollectionAdminRequest.createCollection("ocptest" + i,"conf1",4,1).processAsync(String.valueOf(i), client);
+ CollectionAdminRequest.createCollection("ocptest" + i,"conf1",3,1).processAsync(String.valueOf(i), client);
}
boolean pass = false;
@@ -209,7 +209,7 @@ public class MultiThreadedOCPTest extends AbstractFullDistribZkTestBase {
private void testDeduplicationOfSubmittedTasks() throws IOException, SolrServerException {
try (SolrClient client = createNewSolrClient("", getBaseUrl((HttpSolrClient) clients.get(0)))) {
- CollectionAdminRequest.createCollection("ocptest_shardsplit2","conf1",4,1).processAsync("3000",client);
+ CollectionAdminRequest.createCollection("ocptest_shardsplit2","conf1",3,1).processAsync("3000",client);
SplitShard splitShardRequest = CollectionAdminRequest.splitShard("ocptest_shardsplit2").setShardName(SHARD1);
splitShardRequest.processAsync("3001",client);
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/eb652b84/solr/core/src/test/org/apache/solr/cloud/OverriddenZkACLAndCredentialsProvidersTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/OverriddenZkACLAndCredentialsProvidersTest.java b/solr/core/src/test/org/apache/solr/cloud/OverriddenZkACLAndCredentialsProvidersTest.java
index f4cbc77..9596371 100644
--- a/solr/core/src/test/org/apache/solr/cloud/OverriddenZkACLAndCredentialsProvidersTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/OverriddenZkACLAndCredentialsProvidersTest.java
@@ -71,7 +71,7 @@ public class OverriddenZkACLAndCredentialsProvidersTest extends SolrTestCaseJ4 {
+ "zookeeper/server1/data";
log.info("ZooKeeper dataDir:" + zkDir);
zkServer = new ZkTestServer(zkDir);
- zkServer.run();
+ zkServer.run(false);
System.setProperty("zkHost", zkServer.getZkAddress());
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/eb652b84/solr/core/src/test/org/apache/solr/cloud/OverseerCollectionConfigSetProcessorTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/OverseerCollectionConfigSetProcessorTest.java b/solr/core/src/test/org/apache/solr/cloud/OverseerCollectionConfigSetProcessorTest.java
index ec51d55..f00bd27 100644
--- a/solr/core/src/test/org/apache/solr/cloud/OverseerCollectionConfigSetProcessorTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/OverseerCollectionConfigSetProcessorTest.java
@@ -32,12 +32,12 @@ import java.util.Set;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.TimeUnit;
+import org.apache.http.client.HttpClient;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.client.solrj.SolrResponse;
-import org.apache.solr.client.solrj.cloud.autoscaling.AutoScalingConfig;
-import org.apache.solr.client.solrj.cloud.autoscaling.BadVersionException;
import org.apache.solr.client.solrj.cloud.DistribStateManager;
import org.apache.solr.client.solrj.cloud.SolrCloudManager;
+import org.apache.solr.client.solrj.cloud.autoscaling.AutoScalingConfig;
import org.apache.solr.client.solrj.cloud.autoscaling.VersionedData;
import org.apache.solr.client.solrj.impl.ClusterStateProvider;
import org.apache.solr.cloud.Overseer.LeaderStatus;
@@ -60,11 +60,13 @@ import org.apache.solr.common.util.ObjectCache;
import org.apache.solr.common.util.StrUtils;
import org.apache.solr.common.util.TimeSource;
import org.apache.solr.common.util.Utils;
-import org.apache.solr.handler.component.ShardHandler;
-import org.apache.solr.handler.component.ShardHandlerFactory;
+import org.apache.solr.core.CoreContainer;
+import org.apache.solr.handler.component.HttpShardHandler;
+import org.apache.solr.handler.component.HttpShardHandlerFactory;
import org.apache.solr.handler.component.ShardRequest;
+import org.apache.solr.update.UpdateShardHandler;
import org.apache.solr.util.TimeOut;
-import org.apache.zookeeper.CreateMode;
+import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.data.Stat;
import org.junit.After;
import org.junit.AfterClass;
@@ -72,6 +74,7 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
+import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.slf4j.Logger;
@@ -102,6 +105,7 @@ public class OverseerCollectionConfigSetProcessorTest extends SolrTestCaseJ4 {
private static final String CONFIG_NAME = "myconfig";
private static OverseerTaskQueue workQueueMock;
+ private static OverseerTaskQueue stateUpdateQueueMock;
private static Overseer overseerMock;
private static ZkController zkControllerMock;
private static SolrCloudManager cloudDataProviderMock;
@@ -109,15 +113,21 @@ public class OverseerCollectionConfigSetProcessorTest extends SolrTestCaseJ4 {
private static DistributedMap runningMapMock;
private static DistributedMap completedMapMock;
private static DistributedMap failureMapMock;
- private static ShardHandlerFactory shardHandlerFactoryMock;
- private static ShardHandler shardHandlerMock;
+ private static HttpShardHandlerFactory shardHandlerFactoryMock;
+ private static HttpShardHandler shardHandlerMock;
private static ZkStateReader zkStateReaderMock;
private static ClusterState clusterStateMock;
private static SolrZkClient solrZkClientMock;
private static DistribStateManager stateManagerMock;
+ private static SolrCloudManager cloudManagerMock;
+ private static DistribStateManager distribStateManagerMock;
+ private static CoreContainer coreContainerMock;
+ private static UpdateShardHandler updateShardHandlerMock;
+ private static HttpClient httpClientMock;
+
private static ObjectCache objectCache;
private static AutoScalingConfig autoScalingConfig = new AutoScalingConfig(Collections.emptyMap());
- private final Map zkMap = new HashMap();
+ private Map<String, byte[]> zkClientData = new HashMap<>();
private final Map<String, ClusterState.CollectionRef> collectionsSet = new HashMap<>();
private final List<ZkNodeProps> replicas = new ArrayList<>();
private SolrResponse lastProcessMessageResult;
@@ -133,13 +143,13 @@ public class OverseerCollectionConfigSetProcessorTest extends SolrTestCaseJ4 {
public OverseerCollectionConfigSetProcessorToBeTested(ZkStateReader zkStateReader,
- String myId, ShardHandlerFactory shardHandlerFactory,
+ String myId, HttpShardHandlerFactory shardHandlerFactory,
String adminPath,
OverseerTaskQueue workQueue, DistributedMap runningMap,
Overseer overseer,
DistributedMap completedMap,
DistributedMap failureMap) {
- super(zkStateReader, myId, shardHandlerFactory, adminPath, new Stats(), overseer, new OverseerNodePrioritizer(zkStateReader, adminPath, shardHandlerFactory), workQueue, runningMap, completedMap, failureMap);
+ super(zkStateReader, myId, shardHandlerFactory, adminPath, new Stats(), overseer, new OverseerNodePrioritizer(zkStateReader, overseer.getStateUpdateQueue(), adminPath, shardHandlerFactory, null), workQueue, runningMap, completedMap, failureMap);
}
@Override
@@ -154,11 +164,12 @@ public class OverseerCollectionConfigSetProcessorTest extends SolrTestCaseJ4 {
assumeWorkingMockito();
workQueueMock = mock(OverseerTaskQueue.class);
+ stateUpdateQueueMock = mock(OverseerTaskQueue.class);
runningMapMock = mock(DistributedMap.class);
completedMapMock = mock(DistributedMap.class);
failureMapMock = mock(DistributedMap.class);
- shardHandlerFactoryMock = mock(ShardHandlerFactory.class);
- shardHandlerMock = mock(ShardHandler.class);
+ shardHandlerFactoryMock = mock(HttpShardHandlerFactory.class);
+ shardHandlerMock = mock(HttpShardHandler.class);
zkStateReaderMock = mock(ZkStateReader.class);
clusterStateMock = mock(ClusterState.class);
solrZkClientMock = mock(SolrZkClient.class);
@@ -168,11 +179,17 @@ public class OverseerCollectionConfigSetProcessorTest extends SolrTestCaseJ4 {
objectCache = new ObjectCache();
clusterStateProviderMock = mock(ClusterStateProvider.class);
stateManagerMock = mock(DistribStateManager.class);
+ cloudManagerMock = mock(SolrCloudManager.class);
+ distribStateManagerMock = mock(DistribStateManager.class);
+ coreContainerMock = mock(CoreContainer.class);
+ updateShardHandlerMock = mock(UpdateShardHandler.class);
+ httpClientMock = mock(HttpClient.class);
}
@AfterClass
public static void tearDownOnce() {
workQueueMock = null;
+ stateUpdateQueueMock = null;
runningMapMock = null;
completedMapMock = null;
failureMapMock = null;
@@ -185,6 +202,11 @@ public class OverseerCollectionConfigSetProcessorTest extends SolrTestCaseJ4 {
zkControllerMock = null;
cloudDataProviderMock = null;
clusterStateProviderMock = null;
+ cloudManagerMock = null;
+ distribStateManagerMock = null;
+ coreContainerMock = null;
+ updateShardHandlerMock = null;
+ httpClientMock = null;
}
@Before
@@ -192,6 +214,7 @@ public class OverseerCollectionConfigSetProcessorTest extends SolrTestCaseJ4 {
super.setUp();
queue.clear();
reset(workQueueMock);
+ reset(stateUpdateQueueMock);
reset(runningMapMock);
reset(completedMapMock);
reset(failureMapMock);
@@ -208,8 +231,13 @@ public class OverseerCollectionConfigSetProcessorTest extends SolrTestCaseJ4 {
when(cloudDataProviderMock.getTimeSource()).thenReturn(TimeSource.NANO_TIME);
reset(clusterStateProviderMock);
reset(stateManagerMock);
+ reset(cloudManagerMock);
+ reset(distribStateManagerMock);
+ reset(coreContainerMock);
+ reset(updateShardHandlerMock);
+ reset(httpClientMock);
- zkMap.clear();
+ zkClientData.clear();
collectionsSet.clear();
replicas.clear();
}
@@ -222,6 +250,7 @@ public class OverseerCollectionConfigSetProcessorTest extends SolrTestCaseJ4 {
protected Set<String> commonMocks(int liveNodesCount) throws Exception {
when(shardHandlerFactoryMock.getShardHandler()).thenReturn(shardHandlerMock);
+ when(shardHandlerFactoryMock.getShardHandler(any())).thenReturn(shardHandlerMock);
when(workQueueMock.peekTopN(anyInt(), any(), anyLong())).thenAnswer(invocation -> {
Object result;
int count = 0;
@@ -305,93 +334,191 @@ public class OverseerCollectionConfigSetProcessorTest extends SolrTestCaseJ4 {
});
when(clusterStateMock.getLiveNodes()).thenReturn(liveNodes);
- Map<String, byte[]> zkClientData = new HashMap<>();
+
when(solrZkClientMock.setData(anyString(), any(), anyInt(), anyBoolean())).then(invocation -> {
- zkClientData.put(invocation.getArgument(0), invocation.getArgument(1));
+ System.out.println("set data: " + invocation.getArgument(0) + " " + invocation.getArgument(1));
+ if (invocation.getArgument(1) == null) {
+ zkClientData.put(invocation.getArgument(0), new byte[0]);
+ } else {
+ zkClientData.put(invocation.getArgument(0), invocation.getArgument(1));
+ }
+ return null;
+ });
+
+ when(solrZkClientMock.getData(anyString(), any(), any(), anyBoolean())).thenAnswer(invocation -> {
+ byte[] data = zkClientData.get(invocation.getArgument(0));
+ if (data == null || data.length == 0) {
return null;
}
- );
- when(solrZkClientMock.getData(anyString(), any(), any(), anyBoolean())).then(invocation ->
- zkClientData.get(invocation.getArgument(0)));
+ return data;
+ });
+
when(solrZkClientMock.create(any(), any(), any(), anyBoolean())).thenAnswer(invocation -> {
- String key = invocation.getArgument(0);
- zkMap.put(key, null);
- handleCreateCollMessage(invocation.getArgument(1));
- return key;
+ zkClientData.put(invocation.getArgument(0), invocation.getArgument(1));
+ return invocation.getArgument(0);
});
when(solrZkClientMock.exists(any(String.class), anyBoolean())).thenAnswer(invocation -> {
String key = invocation.getArgument(0);
- return zkMap.containsKey(key);
+ return zkClientData.containsKey(key);
});
when(overseerMock.getZkController()).thenReturn(zkControllerMock);
when(overseerMock.getSolrCloudManager()).thenReturn(cloudDataProviderMock);
+ when(overseerMock.getCoreContainer()).thenReturn(coreContainerMock);
+ when(coreContainerMock.getUpdateShardHandler()).thenReturn(updateShardHandlerMock);
+ when(updateShardHandlerMock.getDefaultHttpClient()).thenReturn(httpClientMock);
+
when(zkControllerMock.getSolrCloudManager()).thenReturn(cloudDataProviderMock);
when(cloudDataProviderMock.getClusterStateProvider()).thenReturn(clusterStateProviderMock);
when(clusterStateProviderMock.getClusterState()).thenReturn(clusterStateMock);
when(clusterStateProviderMock.getLiveNodes()).thenReturn(liveNodes);
when(clusterStateProviderMock.getClusterProperties()).thenReturn(Utils.makeMap(DEFAULTS, Utils.makeMap(CLUSTER, Utils.makeMap(USE_LEGACY_REPLICA_ASSIGNMENT, true))));
when(cloudDataProviderMock.getDistribStateManager()).thenReturn(stateManagerMock);
- when(stateManagerMock.hasData(anyString())).thenAnswer(invocation -> zkMap.containsKey(invocation.getArgument(0)));
- when(stateManagerMock.getAutoScalingConfig()).thenReturn(autoScalingConfig);
- doAnswer(new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) throws Throwable {
- if (!zkMap.containsKey(invocation.getArgument(0))) {
- zkMap.put(invocation.getArgument(0), "");
- }
- return null;
- }
- }).when(stateManagerMock).makePath(anyString());
- doAnswer(new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) throws Throwable {
- VersionedData d = new VersionedData(0, invocation.getArgument(1), "test");
- zkMap.put(invocation.getArgument(0), d);
+ when(cloudManagerMock.getDistribStateManager()).thenReturn(distribStateManagerMock);
+ when(distribStateManagerMock.getAutoScalingConfig()).thenReturn(new AutoScalingConfig(Collections.emptyMap()));
+
+ Mockito.doAnswer(
+ new Answer<Void>() {
+ public Void answer(InvocationOnMock invocation) {
+ System.out.println("set data: " + invocation.getArgument(0) + " " + invocation.getArgument(1));
+ if (invocation.getArgument(1) == null) {
+ zkClientData.put(invocation.getArgument(0), new byte[0]);
+ } else {
+ zkClientData.put(invocation.getArgument(0), invocation.getArgument(1));
+ }
+
+ return null;
+ }}).when(distribStateManagerMock).setData(anyString(), any(), anyInt());
+
+ when(distribStateManagerMock.getData(anyString(), any())).thenAnswer(invocation -> {
+ byte[] data = zkClientData.get(invocation.getArgument(0));
+ if (data == null || data.length == 0) {
return null;
}
- }).when(stateManagerMock).createData(anyString(), any(byte[].class), any(CreateMode.class));
- doAnswer(new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) throws Throwable {
- VersionedData d = (VersionedData)zkMap.get(invocation.getArgument(0));
- if (d != null && d.getVersion() != (Integer)invocation.getArgument(2)) {
- throw new BadVersionException(invocation.getArgument(2), invocation.getArgument(0));
- }
- int version = (Integer)invocation.getArgument(2) + 1;
- zkMap.put(invocation.getArgument(0), new VersionedData(version, invocation.getArgument(1), "test"));
- return null;
+ return new VersionedData(-1, data, "");
+
+ });
+
+ when(distribStateManagerMock.createData(any(), any(), any())).thenAnswer(invocation -> {
+ System.out.println("set data: " + invocation.getArgument(0) + " " + invocation.getArgument(1));
+ if (invocation.getArgument(1) == null) {
+ zkClientData.put(invocation.getArgument(0), new byte[0]);
+ } else {
+ zkClientData.put(invocation.getArgument(0), invocation.getArgument(1));
}
- }).when(stateManagerMock).setData(anyString(), any(byte[].class), anyInt());
- when(stateManagerMock.getData(anyString(), any())).thenAnswer(invocation -> zkMap.get(invocation.getArgument(0)));
+ return null;
+ });
+
+ when(distribStateManagerMock.hasData(anyString()))
+ .then(invocation -> zkClientData.containsKey(invocation.getArgument(0)) && zkClientData.get(invocation.getArgument(0)).length > 0);
+
+ Mockito.doAnswer(
+ new Answer<Void>() {
+ public Void answer(InvocationOnMock invocation) {
+ System.out.println("set data: " + invocation.getArgument(0) + " " + new byte[0]);
+ zkClientData.put(invocation.getArgument(0), new byte[0]);
+ return null;
+ }}).when(distribStateManagerMock).makePath(anyString());
when(solrZkClientMock.exists(any(String.class), isNull(), anyBoolean())).thenAnswer(invocation -> {
String key = invocation.getArgument(0);
- if (zkMap.containsKey(key)) {
+ if (zkClientData.containsKey(key)) {
return new Stat();
} else {
return null;
}
});
-
- zkMap.put("/configs/myconfig", null);
+
+ when(cloudManagerMock.getClusterStateProvider()).thenReturn(clusterStateProviderMock);
+ when(cloudManagerMock.getTimeSource()).thenReturn(new TimeSource.NanoTimeSource());
+ when(cloudManagerMock.getDistribStateManager()).thenReturn(distribStateManagerMock);
+
+ when(overseerMock.getSolrCloudManager()).thenReturn(cloudManagerMock);
+
+ when(overseerMock.getStateUpdateQueue(any())).thenReturn(stateUpdateQueueMock);
+ when(overseerMock.getStateUpdateQueue()).thenReturn(stateUpdateQueueMock);
+
+ Mockito.doAnswer(
+ new Answer<Void>() {
+ public Void answer(InvocationOnMock invocation) {
+ try {
+ handleCreateCollMessage(invocation.getArgument(0));
+ stateUpdateQueueMock.offer(invocation.getArgument(0));
+ } catch (KeeperException e) {
+ throw new RuntimeException(e);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ return null;
+ }}).when(overseerMock).offerStateUpdate(any());
+
+ when(zkControllerMock.getZkClient()).thenReturn(solrZkClientMock);
+
+ when(cloudManagerMock.getDistribStateManager()).thenReturn(distribStateManagerMock);
+ when(distribStateManagerMock.getAutoScalingConfig()).thenReturn(new AutoScalingConfig(Collections.emptyMap()));
+
+ Mockito.doAnswer(
+ new Answer<Void>() {
+ public Void answer(InvocationOnMock invocation) {
+ System.out.println("set data: " + invocation.getArgument(0) + " " + invocation.getArgument(1));
+ if (invocation.getArgument(1) == null) {
+ zkClientData.put(invocation.getArgument(0), new byte[0]);
+ } else {
+ zkClientData.put(invocation.getArgument(0), invocation.getArgument(1));
+ }
+
+ return null;
+ }}).when(distribStateManagerMock).setData(anyString(), any(), anyInt());
+
+ when(distribStateManagerMock.getData(anyString(), any())).thenAnswer(invocation -> {
+ byte[] data = zkClientData.get(invocation.getArgument(0));
+ if (data == null || data.length == 0) {
+ return null;
+ }
+ return new VersionedData(-1, data, "");
+
+ });
+
+ when(distribStateManagerMock.createData(any(), any(), any())).thenAnswer(invocation -> {
+ System.out.println("set data: " + invocation.getArgument(0) + " " + invocation.getArgument(1));
+ if (invocation.getArgument(1) == null) {
+ zkClientData.put(invocation.getArgument(0), new byte[0]);
+ } else {
+ zkClientData.put(invocation.getArgument(0), invocation.getArgument(1));
+ }
+ return null;
+ });
+
+ when(distribStateManagerMock.hasData(anyString()))
+ .then(invocation -> zkClientData.containsKey(invocation.getArgument(0)) && zkClientData.get(invocation.getArgument(0)).length > 0);
+
+ Mockito.doAnswer(
+ new Answer<Void>() {
+ public Void answer(InvocationOnMock invocation) {
+ System.out.println("set data: " + invocation.getArgument(0) + " " + new byte[0]);
+ zkClientData.put(invocation.getArgument(0), new byte[0]);
+ return null;
+ }}).when(distribStateManagerMock).makePath(anyString());
+
+ zkClientData.put("/configs/myconfig", new byte[1]);
return liveNodes;
}
private void handleCreateCollMessage(byte[] bytes) {
+ log.info("track created replicas / collections");
try {
ZkNodeProps props = ZkNodeProps.load(bytes);
- if(CollectionParams.CollectionAction.CREATE.isEqual(props.getStr("operation"))){
- String collName = props.getStr("name") ;
- if(collName != null) collectionsSet.put(collName, new ClusterState.CollectionRef(
+ if (CollectionParams.CollectionAction.CREATE.isEqual(props.getStr("operation"))) {
+ String collName = props.getStr("name");
+ if (collName != null) collectionsSet.put(collName, new ClusterState.CollectionRef(
new DocCollection(collName, new HashMap<>(), props.getProperties(), DocRouter.DEFAULT)));
}
if (CollectionParams.CollectionAction.ADDREPLICA.isEqual(props.getStr("operation"))) {
replicas.add(props);
}
- } catch (Exception e) { }
+ } catch (Exception e) {}
}
protected void startComponentUnderTest() {
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/eb652b84/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java b/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java
index 5fa64a9..895d81b 100644
--- a/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java
@@ -72,8 +72,12 @@ public class OverseerRolesTest extends SolrCloudTestCase {
URL overseerUrl = new URL("http://" + overseer.substring(0, overseer.indexOf('_')));
int hostPort = overseerUrl.getPort();
for (JettySolrRunner jetty : cluster.getJettySolrRunners()) {
+ try {
if (jetty.getBaseUrl().getPort() == hostPort)
return jetty;
+ } catch (IllegalStateException e) {
+
+ }
}
fail("Couldn't find overseer node " + overseer);
return null; // to keep the compiler happy
@@ -85,8 +89,6 @@ public class OverseerRolesTest extends SolrCloudTestCase {
}
@Test
- //commented 2-Aug-2018 @BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") // 04-May-2018
- //Commented 14-Oct-2018 @BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") // 6-Sep-2018
public void testOverseerRole() throws Exception {
logOverseerState();
@@ -114,7 +116,7 @@ public class OverseerRolesTest extends SolrCloudTestCase {
JettySolrRunner leaderJetty = getOverseerJetty();
logOverseerState();
- ChaosMonkey.stop(leaderJetty);
+ leaderJetty.stop();
waitForNewOverseer(10, overseer3);
// add another node as overseer
@@ -136,7 +138,7 @@ public class OverseerRolesTest extends SolrCloudTestCase {
String leaderId = OverseerCollectionConfigSetProcessor.getLeaderId(zkClient());
String leader = OverseerCollectionConfigSetProcessor.getLeaderNode(zkClient());
log.info("### Sending QUIT to overseer {}", leader);
- Overseer.getStateUpdateQueue(zkClient())
+ getOverseerJetty().getCoreContainer().getZkController().getOverseer().getStateUpdateQueue()
.offer(Utils.toJSON(new ZkNodeProps(Overseer.QUEUE_OPERATION, OverseerAction.QUIT.toLower(),
"id", leaderId)));