SOLR-10397: AutoAddReplicasIntegrationTest should use waitForState instead of ClusterStateUtil

This commit is contained in:
Cao Manh Dat 2017-08-10 09:53:52 +07:00
parent 0aee510849
commit 104578312e
2 changed files with 7 additions and 9 deletions

View File

@ -51,6 +51,10 @@ public class AutoAddReplicasIntegrationTest extends SolrCloudTestCase {
configureCluster(3) configureCluster(3)
.addConfig("conf", configset("cloud-minimal")) .addConfig("conf", configset("cloud-minimal"))
.configure(); .configure();
}
@Test
public void testSimple() throws Exception {
JettySolrRunner jetty1 = cluster.getJettySolrRunner(0); JettySolrRunner jetty1 = cluster.getJettySolrRunner(0);
JettySolrRunner jetty2 = cluster.getJettySolrRunner(1); JettySolrRunner jetty2 = cluster.getJettySolrRunner(1);
JettySolrRunner jetty3 = cluster.getJettySolrRunner(2); JettySolrRunner jetty3 = cluster.getJettySolrRunner(2);
@ -70,12 +74,7 @@ public class AutoAddReplicasIntegrationTest extends SolrCloudTestCase {
.setAutoAddReplicas(false) .setAutoAddReplicas(false)
.setMaxShardsPerNode(3) .setMaxShardsPerNode(3)
.process(cluster.getSolrClient()); .process(cluster.getSolrClient());
}
@Test
public void testSimple() throws Exception{
JettySolrRunner jetty2 = cluster.getJettySolrRunner(1);
JettySolrRunner jetty3 = cluster.getJettySolrRunner(2);
ZkStateReader zkStateReader = cluster.getSolrClient().getZkStateReader(); ZkStateReader zkStateReader = cluster.getSolrClient().getZkStateReader();
// start the tests // start the tests
@ -96,7 +95,8 @@ public class AutoAddReplicasIntegrationTest extends SolrCloudTestCase {
waitForNodeLeave(lostNodeName); waitForNodeLeave(lostNodeName);
waitForState("Waiting for collection " + COLLECTION1, COLLECTION1, clusterShape(2, 1)); waitForState("Waiting for collection " + COLLECTION1, COLLECTION1, clusterShape(2, 1));
jetty3.start(); jetty3.start();
assertTrue("Timeout waiting for all live and active", ClusterStateUtil.waitForAllActiveAndLiveReplicas(cluster.getSolrClient().getZkStateReader(), 90000)); waitForState("Waiting for collection " + COLLECTION1, COLLECTION1, clusterShape(2, 2));
waitForState("Waiting for collection " + COLLECTION2, COLLECTION2, clusterShape(2, 2));
enableAutoAddReplicasInCluster(); enableAutoAddReplicasInCluster();

View File

@ -27,8 +27,6 @@ import org.apache.solr.util.BadHdfsThreadsFilter;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import static org.apache.lucene.util.LuceneTestCase.createTempDir;
@LuceneTestCase.Slow @LuceneTestCase.Slow
@ThreadLeakFilters(defaultFilters = true, filters = { @ThreadLeakFilters(defaultFilters = true, filters = {
BadHdfsThreadsFilter.class, // hdfs currently leaks thread(s) BadHdfsThreadsFilter.class, // hdfs currently leaks thread(s)
@ -40,8 +38,8 @@ public class HdfsAutoAddReplicasIntegrationTest extends AutoAddReplicasIntegrati
@BeforeClass @BeforeClass
public static void setupClass() throws Exception { public static void setupClass() throws Exception {
System.setProperty("solr.hdfs.blockcache.enabled", "false");
dfsCluster = HdfsTestUtil.setupClass(createTempDir().toFile().getAbsolutePath()); dfsCluster = HdfsTestUtil.setupClass(createTempDir().toFile().getAbsolutePath());
System.setProperty("solr.hdfs.blockcache.blocksperbank", "2048");
ZkConfigManager configManager = new ZkConfigManager(zkClient()); ZkConfigManager configManager = new ZkConfigManager(zkClient());
configManager.uploadConfigDir(configset("cloud-hdfs"), "conf"); configManager.uploadConfigDir(configset("cloud-hdfs"), "conf");