You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by th...@apache.org on 2014/09/29 17:19:13 UTC
svn commit: r1628203 -
/lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java
Author: thelabdude
Date: Mon Sep 29 15:19:13 2014
New Revision: 1628203
URL: http://svn.apache.org/r1628203
Log:
SOLR-6511: adjust test logic to account for timing issues in zk session expiration scenario.
Modified:
lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java
Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java?rev=1628203&r1=1628202&r2=1628203&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java Mon Sep 29 15:19:13 2014
@@ -302,36 +302,23 @@ public class HttpPartitionTest extends A
cloudClient.getZkStateReader().getLeaderRetry(testCollectionName, "shard1");
assertEquals(expectedNewLeaderCoreNodeName, currentLeader.getName());
+ // TODO: This test logic seems to be timing dependent and fails on Jenkins
+ // need to come up with a better approach
log.info("Sending doc 2 to old leader "+leader.getName());
try {
leaderSolr.add(doc);
leaderSolr.shutdown();
- Replica oldLeaderInRecovery = null;
- for (Replica next : getActiveOrRecoveringReplicas(testCollectionName, "shard1")) {
- if (next.getName().equals(leader.getName()) &&
- ZkStateReader.RECOVERING.equals(next.getStr(ZkStateReader.STATE_PROP)))
- {
- oldLeaderInRecovery = next;
- break;
- }
- }
-
- // if the old leader is not active or recovering, the add should have failed
- if (oldLeaderInRecovery != null) {
- HttpSolrServer oldLeaderSolr = getHttpSolrServer(oldLeaderInRecovery, testCollectionName);
- try {
- assertDocExists(oldLeaderSolr, testCollectionName, "2");
- } finally {
- oldLeaderSolr.shutdown();
- }
- } else {
- fail("Send doc 2 to old leader " + leader.getName() +
- " should have failed! ClusterState: " + printClusterStateInfo(testCollectionName));
+ // if the add worked, then the doc must exist on the new leader
+ HttpSolrServer newLeaderSolr = getHttpSolrServer(currentLeader, testCollectionName);
+ try {
+ assertDocExists(newLeaderSolr, testCollectionName, "2");
+ } finally {
+ newLeaderSolr.shutdown();
}
} catch (SolrException exc) {
- // this is expected ..
+ // this is ok provided the doc doesn't exist on the current leader
leaderSolr = getHttpSolrServer(currentLeader, testCollectionName);
try {
leaderSolr.add(doc); // this should work