lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1428447 - /lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java
Date Thu, 03 Jan 2013 16:23:21 GMT
Author: rmuir
Date: Thu Jan  3 16:23:21 2013
New Revision: 1428447

URL: http://svn.apache.org/viewvc?rev=1428447&view=rev
Log:
don't always do the same things in the same order in this test

Modified:
    lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java

Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java?rev=1428447&r1=1428446&r2=1428447&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java Thu
Jan  3 16:23:21 2013
@@ -1032,18 +1032,19 @@ public class TestIndexWriter extends Luc
             doc.add(newField(random, "field", "some text contents", storedTextType));
             for(int i=0;i<100;i++) {
               idField.setStringValue(Integer.toString(i));
-              if (i%30 == 0) {
+              int action = random.nextInt(100);
+              if (action%30 == 0) {
                 w.deleteAll();
-              } else if (i%2 == 0) {
+              } else if (action%2 == 0) {
                 w.updateDocument(new Term("id", idField.stringValue()), doc);
               } else {
                 w.addDocument(doc);
               }
-              if (i%3 == 0) {
+              if (random.nextInt(3) == 0) {
                 IndexReader r = null;
                 boolean success = false;
                 try {
-                  r = DirectoryReader.open(w, true);
+                  r = DirectoryReader.open(w, random.nextBoolean());
                   success = true;
                 } finally {
                   if (success) {
@@ -1056,7 +1057,7 @@ public class TestIndexWriter extends Luc
               if (i%10 == 0) {
                 w.commit();
               }
-              if (i%40 == 0) {
+              if (random.nextInt(50) == 0) {
                 w.forceMerge(1);
               }
             }



Mime
View raw message