From 2d7df11ab8a500959ff5b4203799ddb7c0eccc76 Mon Sep 17 00:00:00 2001 From: Timothy Potter Date: Thu, 13 Aug 2015 19:06:04 +0000 Subject: [PATCH] SOLR-7921: Fix non-reproducible test failure on sarowe's Jenkins by adding a brief wait before checking that tech product docs have been committed to the example server git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1695752 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/solr/util/TestSolrCLIRunExample.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/solr/core/src/test/org/apache/solr/util/TestSolrCLIRunExample.java b/solr/core/src/test/org/apache/solr/util/TestSolrCLIRunExample.java index d45893b07a3..928c8eccef3 100644 --- a/solr/core/src/test/org/apache/solr/util/TestSolrCLIRunExample.java +++ b/solr/core/src/test/org/apache/solr/util/TestSolrCLIRunExample.java @@ -344,7 +344,17 @@ public class TestSolrCLIRunExample extends SolrTestCaseJ4 { SolrQuery query = new SolrQuery("*:*"); QueryResponse qr = solrClient.query(query); long numFound = qr.getResults().getNumFound(); - assertTrue("expected 32 docs in the "+exampleName+" example but found " + numFound + ", output: " + toolOutput, + if (numFound == 0) { + // brief wait in case of timing issue in getting the new docs committed + log.warn("Going to wait for 1 second before re-trying query for techproduct example docs ..."); + try { + Thread.sleep(1000); + } catch (InterruptedException ignore) { + Thread.interrupted(); + } + numFound = solrClient.query(query).getResults().getNumFound(); + } + assertTrue("expected 32 docs in the " + exampleName + " example but found " + numFound + ", output: " + toolOutput, numFound == 32); }