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 2020/11/13 23:47:46 UTC
[lucene-solr] branch reference_impl_dev updated: @1185 Harden test.
This is an automated email from the ASF dual-hosted git repository.
markrmiller pushed a commit to branch reference_impl_dev
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/reference_impl_dev by this push:
new 6a37309 @1185 Harden test.
6a37309 is described below
commit 6a373092e5d18b32e55e7477100ac6ed998c8b87
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Fri Nov 13 17:47:29 2020 -0600
@1185 Harden test.
---
.../solr/cloud/TestDownShardTolerantSearch.java | 27 ++++++++++++----------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestDownShardTolerantSearch.java b/solr/core/src/test/org/apache/solr/cloud/TestDownShardTolerantSearch.java
index 583deb8..b58b235 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestDownShardTolerantSearch.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestDownShardTolerantSearch.java
@@ -53,8 +53,7 @@ public class TestDownShardTolerantSearch extends SolrCloudTestCase {
@Test
public void searchingShouldFailWithoutTolerantSearchSetToTrue() throws Exception {
- CollectionAdminRequest.createCollection("tolerant", "conf", 2, 1)
- .process(cluster.getSolrClient());
+ CollectionAdminRequest.createCollection("tolerant", "conf", 2, 1).process(cluster.getSolrClient());
UpdateRequest update = new UpdateRequest();
for (int i = 0; i < 100; i++) {
@@ -72,20 +71,24 @@ public class TestDownShardTolerantSearch extends SolrCloudTestCase {
response = cluster.getSolrClient().query("tolerant", new SolrQuery("*:*").setRows(1).setParam(ShardParams.SHARDS_TOLERANT, true));
} catch (BaseHttpSolrClient.RemoteExecutionException e) {
// a remote node we are proxied too may still think this is live, try again
- Thread.sleep(100);
- response = cluster.getSolrClient().query("tolerant", new SolrQuery("*:*").setRows(1).setParam(ShardParams.SHARDS_TOLERANT, true));
+ Thread.sleep(250);
+ try {
+ response = cluster.getSolrClient().query("tolerant", new SolrQuery("*:*").setRows(1).setParam(ShardParams.SHARDS_TOLERANT, true));
+ } catch (BaseHttpSolrClient.RemoteExecutionException e1) {
+ // a remote node we are proxied too may still think this is live, try again
+ Thread.sleep(500);
+
+ response = cluster.getSolrClient().query("tolerant", new SolrQuery("*:*").setRows(1).setParam(ShardParams.SHARDS_TOLERANT, true));
+
+ }
}
assertThat(response.getStatus(), is(0));
assertTrue(response.getResults().getNumFound() > 0);
- SolrServerException e = expectThrows(SolrServerException.class,
- "Request should have failed because we killed shard1 jetty",
- () -> cluster.getSolrClient().query("tolerant", new SolrQuery("*:*").setRows(1)
- .setParam(ShardParams.SHARDS_TOLERANT, false))
- );
+ SolrServerException e = expectThrows(SolrServerException.class, "Request should have failed because we killed shard1 jetty",
+ () -> cluster.getSolrClient().query("tolerant", new SolrQuery("*:*").setRows(1).setParam(ShardParams.SHARDS_TOLERANT, false)));
assertNotNull(e.getCause());
- assertTrue("Error message from server should have the name of the down shard",
- e.getCause().getMessage().contains("shard"));
+ assertTrue("Error message from server should have the name of the down shard", e.getCause().getMessage().contains("shard"));
+ }
}
-}