You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by da...@apache.org on 2017/06/22 02:23:37 UTC

lucene-solr:master: SOLR-8256: Fix CollectionsAPISolrJTest and UnloadDistributedZkTest failures (caused by first commmit)

Repository: lucene-solr
Updated Branches:
  refs/heads/master d3f9059d2 -> d0d30464d


SOLR-8256: Fix CollectionsAPISolrJTest and UnloadDistributedZkTest failures (caused by first commmit)


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/d0d30464
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/d0d30464
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/d0d30464

Branch: refs/heads/master
Commit: d0d30464dd7150fa47b38520241a906514fc94c3
Parents: d3f9059
Author: Cao Manh Dat <da...@apache.org>
Authored: Thu Jun 22 09:23:28 2017 +0700
Committer: Cao Manh Dat <da...@apache.org>
Committed: Thu Jun 22 09:23:28 2017 +0700

----------------------------------------------------------------------
 .../solr/cloud/CollectionsAPISolrJTest.java     |  4 ++--
 .../solr/cloud/UnloadDistributedZkTest.java     | 23 ++++++++++++++------
 2 files changed, 18 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/d0d30464/solr/core/src/test/org/apache/solr/cloud/CollectionsAPISolrJTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/CollectionsAPISolrJTest.java b/solr/core/src/test/org/apache/solr/cloud/CollectionsAPISolrJTest.java
index df3f8bc..d7a43c8 100644
--- a/solr/core/src/test/org/apache/solr/cloud/CollectionsAPISolrJTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/CollectionsAPISolrJTest.java
@@ -269,8 +269,8 @@ public class CollectionsAPISolrJTest extends SolrCloudTestCase {
 
     // sanity check our expected default
     final ClusterProperties props = new ClusterProperties(zkClient());
-    assertEquals("Expecting legacyCloud to false as default",
-                 props.getClusterProperty(ZkStateReader.LEGACY_CLOUD, null), "false");
+    assertEquals("Expecting prop to default to unset, test needs upated",
+                 props.getClusterProperty(ZkStateReader.LEGACY_CLOUD, null), null);
     
     CollectionAdminResponse response = CollectionAdminRequest.setClusterProperty(ZkStateReader.LEGACY_CLOUD, "true")
       .process(cluster.getSolrClient());

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/d0d30464/solr/core/src/test/org/apache/solr/cloud/UnloadDistributedZkTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/UnloadDistributedZkTest.java b/solr/core/src/test/org/apache/solr/cloud/UnloadDistributedZkTest.java
index c51904f..460453c 100644
--- a/solr/core/src/test/org/apache/solr/cloud/UnloadDistributedZkTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/UnloadDistributedZkTest.java
@@ -151,6 +151,16 @@ public class UnloadDistributedZkTest extends BasicDistributedZkTest {
     assertTrue("No longer found collection "+collection, getCommonCloudSolrClient().getZkStateReader().getClusterState().hasCollection(collection));
   }
 
+  protected SolrCore getFirstCore(String collection, JettySolrRunner jetty) {
+    SolrCore solrCore = null;
+    for (SolrCore core : jetty.getCoreContainer().getCores()) {
+      if (core.getName().startsWith(collection)) {
+        solrCore = core;
+      }
+    }
+    return solrCore;
+  }
+
   /**
    * @throws Exception on any problem
    */
@@ -167,9 +177,8 @@ public class UnloadDistributedZkTest extends BasicDistributedZkTest {
 
     int slices = zkStateReader.getClusterState().getCollection("unloadcollection").getSlices().size();
     assertEquals(1, slices);
-    SolrCore solrCore = jetty1.getCoreContainer().getCore("unloadcollection_shard1_replica1");
+    SolrCore solrCore = getFirstCore("unloadcollection", jetty1);
     String core1DataDir = solrCore.getDataDir();
-    solrCore.close();
 
     assertTrue(CollectionAdminRequest
         .addReplicaToShard("unloadcollection", "shard1")
@@ -211,7 +220,7 @@ public class UnloadDistributedZkTest extends BasicDistributedZkTest {
     // so that we start with some versions when we reload...
     DirectUpdateHandler2.commitOnClose = false;
 
-    try (HttpSolrClient addClient = getHttpSolrClient(jettys.get(2).getBaseUrl() + "/unloadcollection_shard1_replica3")) {
+    try (HttpSolrClient addClient = getHttpSolrClient(jettys.get(2).getBaseUrl() + "/" + getFirstCore("unloadcollection", jettys.get(2)).getName())) {
       addClient.setConnectionTimeout(30000);
 
       // add a few docs
@@ -249,7 +258,7 @@ public class UnloadDistributedZkTest extends BasicDistributedZkTest {
     // ensure there is a leader
     zkStateReader.getLeaderRetry("unloadcollection", "shard1", 15000);
 
-    try (HttpSolrClient addClient = getHttpSolrClient(jettys.get(1).getBaseUrl() + "/unloadcollection_shard1_replica2")) {
+    try (HttpSolrClient addClient = getHttpSolrClient(jettys.get(1).getBaseUrl() + "/" + getFirstCore("unloadcollection", jettys.get(1)).getName())) {
       addClient.setConnectionTimeout(30000);
       addClient.setSoTimeout(90000);
 
@@ -301,7 +310,7 @@ public class UnloadDistributedZkTest extends BasicDistributedZkTest {
 
     long found1, found3;
 
-    try (HttpSolrClient adminClient = getHttpSolrClient(jettys.get(1).getBaseUrl() + "/unloadcollection_shard1_replica2")) {
+    try (HttpSolrClient adminClient = getHttpSolrClient(jettys.get(1).getBaseUrl() + "/" + getFirstCore("unloadcollection", jettys.get(1)).getName())) {
       adminClient.setConnectionTimeout(15000);
       adminClient.setSoTimeout(30000);
       adminClient.commit();
@@ -309,7 +318,7 @@ public class UnloadDistributedZkTest extends BasicDistributedZkTest {
       q.set("distrib", false);
       found1 = adminClient.query(q).getResults().getNumFound();
     }
-    try (HttpSolrClient adminClient = getHttpSolrClient(jettys.get(2).getBaseUrl() + "/unloadcollection_shard1_replica3")) {
+    try (HttpSolrClient adminClient = getHttpSolrClient(jettys.get(2).getBaseUrl() + "/" + getFirstCore("unloadcollection", jettys.get(2)).getName())) {
       adminClient.setConnectionTimeout(15000);
       adminClient.setSoTimeout(30000);
       adminClient.commit();
@@ -318,7 +327,7 @@ public class UnloadDistributedZkTest extends BasicDistributedZkTest {
       found3 = adminClient.query(q).getResults().getNumFound();
     }
 
-    try (HttpSolrClient adminClient = getHttpSolrClient(jettys.get(3).getBaseUrl() + "/unloadcollection_shard1_replica4")) {
+    try (HttpSolrClient adminClient = getHttpSolrClient(jettys.get(3).getBaseUrl() + "/" + getFirstCore("unloadcollection", jettys.get(3)).getName())) {
       adminClient.setConnectionTimeout(15000);
       adminClient.setSoTimeout(30000);
       adminClient.commit();