lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From no...@apache.org
Subject [03/50] [abbrv] lucene-solr:apiv2: LUCENE-7422: fix bugs in test's retry loop
Date Wed, 07 Sep 2016 09:56:51 GMT
LUCENE-7422: fix bugs in test's retry loop


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

Branch: refs/heads/apiv2
Commit: 18306628a9658fe6b9fcb1e409e63a5876257e84
Parents: 9811802
Author: Robert Muir <rmuir@apache.org>
Authored: Thu Aug 25 08:20:53 2016 -0400
Committer: Robert Muir <rmuir@apache.org>
Committed: Thu Aug 25 08:20:53 2016 -0400

----------------------------------------------------------------------
 .../org/apache/lucene/index/TestAllFilesCheckIndexHeader.java | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/18306628/lucene/core/src/test/org/apache/lucene/index/TestAllFilesCheckIndexHeader.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/test/org/apache/lucene/index/TestAllFilesCheckIndexHeader.java
b/lucene/core/src/test/org/apache/lucene/index/TestAllFilesCheckIndexHeader.java
index dfb2f1b..b4c6368 100644
--- a/lucene/core/src/test/org/apache/lucene/index/TestAllFilesCheckIndexHeader.java
+++ b/lucene/core/src/test/org/apache/lucene/index/TestAllFilesCheckIndexHeader.java
@@ -28,6 +28,8 @@ import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.IOContext;
 import org.apache.lucene.store.IndexInput;
 import org.apache.lucene.store.IndexOutput;
+import org.apache.lucene.store.MockDirectoryWrapper;
+import org.apache.lucene.store.RAMDirectory;
 import org.apache.lucene.util.LineFileDocs;
 import org.apache.lucene.util.LuceneTestCase.SuppressFileSystems;
 import org.apache.lucene.util.LuceneTestCase;
@@ -84,7 +86,8 @@ public class TestAllFilesCheckIndexHeader extends LuceneTestCase {
   }
   
   private void checkOneFile(Directory dir, String victim) throws IOException {
-    try (BaseDirectoryWrapper dirCopy = newDirectory()) {
+    // use ramdir explicit, as we do evil things like try to generate broken files, deletes
must work.
+    try (BaseDirectoryWrapper dirCopy = new MockDirectoryWrapper(random(), new RAMDirectory()))
{
       dirCopy.setCheckIndexOnClose(false);
 
       long victimLength = dir.fileLength(victim);
@@ -117,6 +120,8 @@ public class TestAllFilesCheckIndexHeader extends LuceneTestCase {
                 break;
               }
             }
+            // we have to try again, delete the first attempt and retry the loop
+            dirCopy.deleteFile(name);
           }
         }
         dirCopy.sync(Collections.singleton(name));


Mime
View raw message