Buggy code:
@ Override public int hashCode ( ) { } @ Override public boolean equals ( Object obj ) { } } @ Before @ Override public void setUp ( ) throws Exception { } @ BeforeClass public static void beforeClass ( ) { } @ AfterClass public static void afterClass ( ) { } public AbstractFullDistribZkTestBase ( ) { } protected void initCloud ( ) throws Exception { } protected CloudSolrServer createCloudClient ( String defaultCollection ) throws MalformedURLException { } @ Override protected void createServers ( int numServers ) throws Exception { } protected void waitForCollection ( ZkStateReader reader , String collection , int slices ) throws Exception { } protected List < JettySolrRunner > createJettys ( int numJettys ) throws Exception { } protected List < JettySolrRunner > createJettys ( int numJettys , boolean checkCreatedVsState ) throws Exception { } protected SolrServer startCloudJetty ( String collection , String shard ) throws Exception { } protected int getTotalReplicas ( String collection ) { } protected void updateMappingsFromZk ( List < JettySolrRunner > jettys , List < SolrServer > clients ) throws Exception { } private AbstractFullDistribZkTestBase . CloudSolrServerClient findClientByPort ( int port , List < AbstractFullDistribZkTestBase . CloudSolrServerClient > theClients ) { } @ Override protected void setDistributedParams ( ModifiableSolrParams params ) { } @ Override protected void indexDoc ( SolrInputDocument doc ) throws IOException , SolrServerException { } @ Override protected void index_specific ( int serverNumber , Object ... fields ) throws Exception { } protected void index_specific ( SolrServer client , Object ... fields ) throws Exception { } @ Override protected void del ( String q ) throws Exception { } protected void waitForRecoveriesToFinish ( boolean verbose ) throws Exception { } protected void waitForRecoveriesToFinish ( String collection , boolean verbose ) throws Exception { } protected void waitForRecoveriesToFinish ( boolean verbose , int timeoutSeconds ) throws Exception { } protected void checkQueries ( ) throws Exception { } protected void indexAbunchOfDocs ( ) throws Exception { } protected void checkShardConsistency ( String shard ) throws Exception { } protected String checkShardConsistency ( String shard , boolean expectFailure , boolean verbose ) throws Exception { } private String toStr ( SolrDocumentList lst , int maxSz ) { } Set < Map > showDiff ( SolrDocumentList a , SolrDocumentList b , String aName , String bName ) { } protected void checkShardConsistency ( ) throws Exception { } protected void checkShardConsistency ( boolean checkVsControl , boolean verbose ) throws Exception { } protected SolrServer getClient ( String nodeName ) { } protected void assertDocCounts ( boolean verbose ) throws Exception { } @ Override protected QueryResponse queryServer ( ModifiableSolrParams params ) throws SolrServerException { } abstract class StopableThread extends Thread { public StopableThread ( String name ) { } public abstract void safeStop ( ) { } } class StopableIndexingThread extends AbstractFullDistribZkTestBase . StopableThread { private volatile boolean stop = false ; protected final int startI ; protected final List < Integer > deletes = new ArrayList < Integer > ( ) ; protected final AtomicInteger fails = new AtomicInteger ( ) ; protected boolean doDeletes ; private int numCycles ; public StopableIndexingThread ( int startI , boolean doDeletes ) { } public StopableIndexingThread ( int startI , boolean doDeletes , int numCycles ) { } @ Override public void run ( ) { } @ Override public void safeStop ( ) { } public int getFails ( ) { } } class StopableSearchThread extends AbstractFullDistribZkTestBase . StopableThread { private volatile boolean stop = false ; protected final AtomicInteger fails = new AtomicInteger ( ) ; private String [ ] QUERIES = new String [ ] { "to<seq2seq4repair_space>come" , "their<seq2seq4repair_space>country" , "aid" , "co*" } ; public StopableSearchThread ( ) { } @ Override public void run ( ) { } @ Override public void safeStop ( ) { } public int getFails ( ) { } } public void waitForThingsToLevelOut ( int waitForRecTimeSeconds ) throws Exception { AbstractFullDistribZkTestBase . log . info ( ( ( "Wait<seq2seq4repair_space>for<seq2seq4repair_space>recoveries<seq2seq4repair_space>to<seq2seq4repair_space>finish<seq2seq4repair_space>-<seq2seq4repair_space>wait<seq2seq4repair_space>" + waitForRecTimeSeconds ) + "<seq2seq4repair_space>for<seq2seq4repair_space>each<seq2seq4repair_space>attempt" ) ) ; int cnt = 0 ; boolean retry = false ; do { waitForRecoveriesToFinish ( VERBOSE , waitForRecTimeSeconds ) ; try { commit ( ) ; } catch ( Throwable t ) { t . printStackTrace ( ) ; } updateMappingsFromZk ( jettys , clients ) ; Set < String > theShards = shardToJetty . keySet ( ) ; String failMessage = null ; for ( String shard : theShards ) { failMessage = checkShardConsistency ( shard , true , false ) ; } if ( failMessage != null ) { retry = true ; } cnt ++ ; <START_BUG> if ( cnt > 10 ) <END_BUG> break ; Thread . sleep ( 2000 ) ; } while ( retry ) ; } @ Override @ After public void tearDown ( ) throws Exception { } @ Override protected void commit ( ) throws Exception { } @ Override protected void destroyServers ( ) throws Exception { } protected void createCollection ( String collectionName , int numShards , int numReplicas , int maxShardsPerNode ) throws IOException , SolrServerException { } protected void createCollection ( Map < String , List < Integer > > collectionInfos , String collectionName , int numShards , int numReplicas , int maxShardsPerNode , SolrServer client , String createNodeSetStr ) throws IOException , SolrServerException { } @ Override protected SolrServer createNewSolrServer ( int port ) { } protected SolrServer createNewSolrServer ( String collection , String baseUrl ) { } protected String getBaseUrl ( HttpSolrServer client ) { } protected SolrInputDocument getDoc ( Object ... fields ) throws Exception { } private String checkCollectionExpectations ( String collectionName , List < Integer > numShardsNumReplicaList , List < String > nodesAllowedToRunShards ) { } protected void checkForCollection ( String collectionName , List < Integer > numShardsNumReplicaList , List < String > nodesAllowedToRunShards ) throws Exception { } volatile CloudSolrServer commondCloudSolrServer ; protected CloudSolrServer getCommonCloudSolrServer ( ) { } }

Fix:
if ( cnt > 20 )