You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2022/11/19 23:19:57 UTC
[lucene] branch branch_9x updated: Prevent TestStressIndexing from taking minutes for normal non-NIGHTLY runs (#11953)
This is an automated email from the ASF dual-hosted git repository.
rmuir pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/lucene.git
The following commit(s) were added to refs/heads/branch_9x by this push:
new 7ed5af39bbf Prevent TestStressIndexing from taking minutes for normal non-NIGHTLY runs (#11953)
7ed5af39bbf is described below
commit 7ed5af39bbfe31c4c9c992e202001e34750f8baf
Author: Robert Muir <rm...@apache.org>
AuthorDate: Sat Nov 19 18:06:52 2022 -0500
Prevent TestStressIndexing from taking minutes for normal non-NIGHTLY runs (#11953)
This test intentionally does a ton of filesystem operations: currently
about 20% of the time you can get really unlucky and get virus checker
simulated, against a real filesystem, which makes things really slow.
Instead use a ByteBuffersDirectory for local runs so that it doesn't
take minutes. The test can still be pretty slow even with this
implementation, so tone down the runtime so that it takes ~ 1.5s
locally.
---
.../src/test/org/apache/lucene/index/TestStressIndexing.java | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/lucene/core/src/test/org/apache/lucene/index/TestStressIndexing.java b/lucene/core/src/test/org/apache/lucene/index/TestStressIndexing.java
index 33e58cc7b13..8fb2d24d473 100644
--- a/lucene/core/src/test/org/apache/lucene/index/TestStressIndexing.java
+++ b/lucene/core/src/test/org/apache/lucene/index/TestStressIndexing.java
@@ -19,6 +19,7 @@ package org.apache.lucene.index;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
+import org.apache.lucene.store.ByteBuffersDirectory;
import org.apache.lucene.store.Directory;
import org.apache.lucene.tests.analysis.MockAnalyzer;
import org.apache.lucene.tests.store.MockDirectoryWrapper;
@@ -28,7 +29,7 @@ import org.apache.lucene.tests.util.LuceneTestCase;
public class TestStressIndexing extends LuceneTestCase {
private abstract static class TimedThread extends Thread {
volatile boolean failed;
- private static int RUN_ITERATIONS = atLeast(100);
+ private static int RUN_ITERATIONS = TEST_NIGHTLY ? atLeast(100) : atLeast(20);
private TimedThread[] allThreads;
public abstract void doWork() throws Throwable;
@@ -156,7 +157,12 @@ public class TestStressIndexing extends LuceneTestCase {
/* */
public void testStressIndexAndSearching() throws Exception {
- Directory directory = newMaybeVirusCheckingDirectory();
+ final Directory directory;
+ if (TEST_NIGHTLY) {
+ directory = newMaybeVirusCheckingDirectory();
+ } else {
+ directory = new MockDirectoryWrapper(random(), new ByteBuffersDirectory());
+ }
if (directory instanceof MockDirectoryWrapper) {
((MockDirectoryWrapper) directory).setAssertNoUnrefencedFilesOnClose(true);
}