Relax elapsed time stats assertion (#55710)
`SearchableSnapshotDirectoryStatsTests#testCachedBytesReadsAndWrites` asserts that each write takes one clock tick, but we now permit concurrent reads and writes so each write might take longer. This commit relaxes the assertion to match. Closes #55707
This commit is contained in:
parent
c89917c799
commit
de30550aea
|
@ -36,6 +36,7 @@ import static org.elasticsearch.index.store.cache.TestUtils.createCacheService;
|
|||
import static org.elasticsearch.index.store.cache.TestUtils.singleBlobContainer;
|
||||
import static org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshots.SNAPSHOT_CACHE_ENABLED_SETTING;
|
||||
import static org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshots.SNAPSHOT_UNCACHED_CHUNK_SIZE_SETTING;
|
||||
import static org.hamcrest.Matchers.allOf;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||
|
@ -117,7 +118,13 @@ public class SearchableSnapshotDirectoryStatsTests extends ESIndexInputTestCase
|
|||
);
|
||||
assertThat(
|
||||
inputStats.getCachedBytesWritten().totalNanoseconds(),
|
||||
equalTo(cachedBytesWriteCount * FAKE_CLOCK_ADVANCE_NANOS)
|
||||
allOf(
|
||||
// each read takes at least FAKE_CLOCK_ADVANCE_NANOS time
|
||||
greaterThanOrEqualTo(FAKE_CLOCK_ADVANCE_NANOS * cachedBytesWriteCount),
|
||||
|
||||
// worst case: we start all reads before finishing any of them
|
||||
lessThanOrEqualTo(FAKE_CLOCK_ADVANCE_NANOS * cachedBytesWriteCount * cachedBytesWriteCount)
|
||||
)
|
||||
);
|
||||
|
||||
assertThat(inputStats.getCachedBytesRead(), notNullValue());
|
||||
|
|
Loading…
Reference in New Issue