lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [04/35] lucene-solr:jira/solr-11779: LUCENE-8324: Fix test to exclude the write.lock in expected files
Date Mon, 28 May 2018 15:39:47 GMT
LUCENE-8324: Fix test to exclude the write.lock in expected files


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/14a7cd11
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/14a7cd11
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/14a7cd11

Branch: refs/heads/jira/solr-11779
Commit: 14a7cd1159bacec38fc1efc8a772f3fbd2abc6ed
Parents: b54e594
Author: Simon Willnauer <simonw@apache.org>
Authored: Wed May 23 07:43:53 2018 +0200
Committer: Simon Willnauer <simonw@apache.org>
Committed: Wed May 23 07:54:59 2018 +0200

----------------------------------------------------------------------
 .../core/src/test/org/apache/lucene/index/TestIndexWriter.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/14a7cd11/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java
index a36920b..570cb5b 100644
--- a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java
+++ b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java
@@ -40,6 +40,7 @@ import java.util.Random;
 import java.util.Set;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.function.Predicate;
 import java.util.stream.Collectors;
 
 import com.carrotsearch.randomizedtesting.generators.RandomPicks;
@@ -3317,11 +3318,12 @@ public class TestIndexWriter extends LuceneTestCase {
   }
 
   private static void assertFiles(IndexWriter writer) throws IOException {
+    Predicate<String> filter = file -> file.startsWith("segments") == false &&
file.equals("write.lock") == false;
     // remove segment files we don't know if we have committed and what is kept around
     Set<String> segFiles = new HashSet<>(writer.segmentInfos.files(true)).stream()
-        .filter(f -> f.startsWith("segments") == false).collect(Collectors.toSet());
+        .filter(filter).collect(Collectors.toSet());
     Set<String> dirFiles = new HashSet<>(Arrays.asList(writer.getDirectory().listAll()))
-        .stream().filter(f -> f.startsWith("segments") == false).collect(Collectors.toSet());
+        .stream().filter(filter).collect(Collectors.toSet());
     Set<String> s = new HashSet<>(segFiles);
     s.removeAll(dirFiles);
     assertEquals(segFiles.toString() + " vs "+ dirFiles.toString(), segFiles.size(), dirFiles.size());


Mime
View raw message