Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

LUCENE-1348: relax TestTimeLimitedCollector.

Doron Cohen82c1724efb34
diff --git a/CHANGES.txt b/CHANGES.txt
index 4c08a29c83a..0f8f199db7a 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -257,6 +257,8 @@ Test Cases
Within this fix, "greedy" flag was added to TimeLimitedCollector, to allow the wrapped
collector to collect also the last doc, after allowed-tTime passed. (Doron Cohen)
+ 2. LUCENE-1348: relax TestTimeLimitedCollector to not fail due to
+ timeout exceeded (just because test machine is very busy).
======================= Release 2.3.2 2008-05-05 =======================
diff --git a/src/test/org/apache/lucene/search/TestTimeLimitedCollector.java b/src/test/org/apache/lucene/search/TestTimeLimitedCollector.java
index 4dea674e968..e14ebd0fc93 100755
--- a/src/test/org/apache/lucene/search/TestTimeLimitedCollector.java
+++ b/src/test/org/apache/lucene/search/TestTimeLimitedCollector.java
@@ -185,12 +185,17 @@ public class TestTimeLimitedCollector extends LuceneTestCase {
// a) Not too early
assertTrue ( "elapsed="+timoutException.getTimeElapsed()+" <= (allowed-resolution)="+(TIME_ALLOWED-TimeLimitedCollector.getResolution()),
timoutException.getTimeElapsed() > TIME_ALLOWED-TimeLimitedCollector.getResolution());
- // b) Not too late (this part might be problematic in a busy system, consider removing it if it raises false test failures.
- assertTrue ( "lastDoc="+exceptionDoc+
+ // b) Not too late.
+ // This part is problematic in a busy test system, so we just print a warning.
+ // We already verified that a timeout occurred, we just can't be picky about how long it took.
+ if (timoutException.getTimeElapsed() > maxTime(multiThreaded)) {
+ System.out.println("Informative: timeout exceeded (no action required: most probably just " +
+ " because the test machine is slower than usual): " +
+ "lastDoc="+exceptionDoc+
" ,&& allowed="+timoutException.getTimeAllowed() +
" ,&& elapsed="+timoutException.getTimeElapsed() +
- " >= " + maxTimeStr(multiThreaded),
- timoutException.getTimeElapsed() < maxTime(multiThreaded));
+ " >= " + maxTimeStr(multiThreaded));
+ }
}
private long maxTime(boolean multiThreaded) {