You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ab...@apache.org on 2017/03/01 09:27:12 UTC
[04/50] [abbrv] lucene-solr:jira/solr-9858: SOLR-10126: Improve test
a bit.
SOLR-10126: Improve test a bit.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/be64c26c
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/be64c26c
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/be64c26c
Branch: refs/heads/jira/solr-9858
Commit: be64c26c270fc9663609492de77c1dec5574afda
Parents: 55ef713
Author: markrmiller <ma...@apache.org>
Authored: Wed Feb 22 12:52:07 2017 -0500
Committer: markrmiller <ma...@apache.org>
Committed: Wed Feb 22 14:44:17 2017 -0500
----------------------------------------------------------------------
.../solr/cloud/PeerSyncReplicationTest.java | 26 ++++++++++++++------
1 file changed, 19 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/be64c26c/solr/core/src/test/org/apache/solr/cloud/PeerSyncReplicationTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/PeerSyncReplicationTest.java b/solr/core/src/test/org/apache/solr/cloud/PeerSyncReplicationTest.java
index 416e95e..0859eb5 100644
--- a/solr/core/src/test/org/apache/solr/cloud/PeerSyncReplicationTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/PeerSyncReplicationTest.java
@@ -195,9 +195,15 @@ public class PeerSyncReplicationTest extends AbstractFullDistribZkTestBase {
}
}
+ class IndexInBackGround extends Thread {
+ private int numDocs;
- private void indexInBackground(int numDocs) {
- new Thread(() -> {
+ public IndexInBackGround(int numDocs) {
+ super(getClassName());
+ this.numDocs = numDocs;
+ }
+
+ public void run() {
try {
for (int i = 0; i < numDocs; i++) {
indexDoc(id, docId, i1, 50, tlong, 50, t1, "document number " + docId);
@@ -209,10 +215,7 @@ public class PeerSyncReplicationTest extends AbstractFullDistribZkTestBase {
log.error("Error indexing doc in background", e);
//Throwing an error here will kill the thread
}
- }, getClassName())
- .start();
-
-
+ }
}
@@ -269,7 +272,8 @@ public class PeerSyncReplicationTest extends AbstractFullDistribZkTestBase {
// disable fingerprint check if needed
System.setProperty("solr.disableFingerprint", String.valueOf(disableFingerprint));
- indexInBackground(50);
+ IndexInBackGround iib = new IndexInBackGround(50);
+ iib.start();
// bring back dead node and ensure it recovers
ChaosMonkey.start(nodeToBringUp.jetty);
@@ -284,6 +288,14 @@ public class PeerSyncReplicationTest extends AbstractFullDistribZkTestBase {
jetties.removeAll(nodesDown);
assertEquals(getShardCount() - nodesDown.size(), jetties.size());
+ waitForThingsToLevelOut(30);
+
+ iib.join();
+
+ cloudClient.commit();
+
+ checkShardConsistency(false, false);
+
long cloudClientDocs = cloudClient.query(new SolrQuery("*:*")).getResults().getNumFound();
assertEquals(docId, cloudClientDocs);