mirror of https://github.com/apache/lucene.git
SOLR-11670: Allow for larger diff in simulated time.
This commit is contained in:
parent
12d543cbb8
commit
25ec5cda0b
|
@ -36,14 +36,18 @@ public class TestTimeSource extends SolrTestCaseJ4 {
|
||||||
long prevTime = ts.getTime();
|
long prevTime = ts.getTime();
|
||||||
long prevEpochTime = ts.getEpochTime();
|
long prevEpochTime = ts.getEpochTime();
|
||||||
long delta = 500000000; // 500 ms
|
long delta = 500000000; // 500 ms
|
||||||
|
long maxDiff = 200000;
|
||||||
|
if (ts instanceof TimeSource.SimTimeSource) {
|
||||||
|
maxDiff = Math.round(maxDiff * ((TimeSource.SimTimeSource)ts).multiplier);
|
||||||
|
}
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
ts.sleep(500);
|
ts.sleep(500);
|
||||||
long curTime = ts.getTime();
|
long curTime = ts.getTime();
|
||||||
long curEpochTime = ts.getEpochTime();
|
long curEpochTime = ts.getEpochTime();
|
||||||
long diff = prevTime + delta - curTime;
|
long diff = prevTime + delta - curTime;
|
||||||
assertTrue(ts + " time diff=" + diff, diff < 100000);
|
assertTrue(ts + " time diff=" + diff, diff < maxDiff);
|
||||||
diff = prevEpochTime + delta - curEpochTime;
|
diff = prevEpochTime + delta - curEpochTime;
|
||||||
assertTrue(ts + " epochTime diff=" + diff, diff < 100000);
|
assertTrue(ts + " epochTime diff=" + diff, diff < maxDiff);
|
||||||
prevTime = curTime;
|
prevTime = curTime;
|
||||||
prevEpochTime = curEpochTime;
|
prevEpochTime = curEpochTime;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue