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 2012/08/04 18:51:54 UTC
svn commit: r1369369 - in /lucene/dev/branches/branch_4x: ./ solr/ solr/core/
solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java
Author: markrmiller
Date: Sat Aug 4 16:51:54 2012
New Revision: 1369369
URL: http://svn.apache.org/viewvc?rev=1369369&view=rev
Log:
retry on 503 along with 404 in this test
Modified:
lucene/dev/branches/branch_4x/ (props changed)
lucene/dev/branches/branch_4x/solr/ (props changed)
lucene/dev/branches/branch_4x/solr/core/ (props changed)
lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java?rev=1369369&r1=1369368&r2=1369369&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java Sat Aug 4 16:51:54 2012
@@ -355,7 +355,7 @@ public class BasicDistributedZkTest exte
HttpSolrServer collectionClient = new HttpSolrServer(url);
// poll for a second - it can take a moment before we are ready to serve
- waitForNon404(collectionClient);
+ waitForNon404or503(collectionClient);
}
List<String> collectionNameList = new ArrayList<String>();
@@ -500,20 +500,21 @@ public class BasicDistributedZkTest exte
throw new RuntimeException("Could not find a live node for collection:" + collection);
}
- private void waitForNon404(HttpSolrServer collectionClient)
+ private void waitForNon404or503(HttpSolrServer collectionClient)
throws Exception {
-
+ SolrException exp = null;
long timeoutAt = System.currentTimeMillis() + 30000;
while (System.currentTimeMillis() < timeoutAt) {
boolean missing = false;
+
try {
collectionClient.query(new SolrQuery("*:*"));
} catch (SolrException e) {
- // How do I get the response code!?
- if (!e.getMessage().contains("(404)")) {
+ if (!(e.code() == 403 || e.code() == 503)) {
throw e;
}
+ exp = e;
missing = true;
}
if (!missing) {
@@ -522,7 +523,7 @@ public class BasicDistributedZkTest exte
Thread.sleep(50);
}
printLayout();
- fail("Could not find the new collection - 404 : " + collectionClient.getBaseURL());
+ fail("Could not find the new collection - " + exp.code() + " : " + collectionClient.getBaseURL());
}
private void checkForCollection(String collectionName, int expectedSlices)