lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [1/2] lucenenet git commit: Some tests just take longer to run...
Date Wed, 07 Jan 2015 00:41:15 GMT
Repository: lucenenet
Updated Branches:
  refs/heads/master f7cc217ff -> e3558b84b


Some tests just take longer to run...


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/45133b20
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/45133b20
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/45133b20

Branch: refs/heads/master
Commit: 45133b20aa7d89c6c7c6586f5fa1a0cd9f149298
Parents: f7cc217
Author: Itamar Syn-Hershko <itamar@code972.com>
Authored: Wed Jan 7 02:38:37 2015 +0200
Committer: Itamar Syn-Hershko <itamar@code972.com>
Committed: Wed Jan 7 02:38:37 2015 +0200

----------------------------------------------------------------------
 .../Index/BasePostingsFormatTestCase.cs         | 54 ++++++++++----------
 .../Index/BaseStoredFieldsFormatTestCase.cs     |  8 +--
 .../Index/BaseTermVectorsFormatTestCase.cs      | 44 ++++++++--------
 .../core/Codecs/Lucene3x/TestSurrogates.cs      |  4 +-
 .../core/Index/TestByteSlices.cs                |  2 +-
 .../core/Index/TestConcurrentMergeScheduler.cs  |  6 +--
 .../core/Index/TestDeletionPolicy.cs            |  2 +-
 .../core/Index/TestDirectoryReader.cs           |  2 +-
 8 files changed, 61 insertions(+), 61 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/45133b20/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs b/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs
index 202be43..b9dfb8b 100644
--- a/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs
@@ -1217,71 +1217,71 @@ namespace Lucene.Net.Index
         private void TestFull(FieldInfo.IndexOptions options, bool withPayloads)
         {
             DirectoryInfo path = CreateTempDir("testPostingsFormat.testExact");
-            Directory dir = NewFSDirectory(path);
-
-            // TODO test thread safety of buildIndex too
-            var fieldsProducer = BuildIndex(dir, options, withPayloads, true);
+            using (Directory dir = NewFSDirectory(path))
+            {
+                // TODO test thread safety of buildIndex too
+                var fieldsProducer = BuildIndex(dir, options, withPayloads, true);
 
-            TestFields(fieldsProducer);
+                TestFields(fieldsProducer);
 
-            var allOptions = (FieldInfo.IndexOptions[])Enum.GetValues(typeof(FieldInfo.IndexOptions));//IndexOptions_e.values();
-            int maxIndexOption = Arrays.AsList(allOptions).IndexOf(options);
+                var allOptions = (FieldInfo.IndexOptions[]) Enum.GetValues(typeof (FieldInfo.IndexOptions));
+                    //IndexOptions_e.values();
+                int maxIndexOption = Arrays.AsList(allOptions).IndexOf(options);
 
-            for (int i = 0; i <= maxIndexOption; i++)
-            {
-                ISet<Option> allOptionsHashSet = new HashSet<Option>(Enum.GetValues(typeof(Option)).Cast<Option>());
-                TestTerms(fieldsProducer, allOptionsHashSet, allOptions[i], options, true);
-                if (withPayloads)
+                for (int i = 0; i <= maxIndexOption; i++)
                 {
-                    // If we indexed w/ payloads, also test enums w/o accessing payloads:
-                    ISet<Option> payloadsHashSet = new HashSet<Option>() { Option.PAYLOADS
};
-                    var complementHashSet = new HashSet<Option>(allOptionsHashSet.Except(payloadsHashSet));
-                    TestTerms(fieldsProducer, complementHashSet, allOptions[i], options,
true);
+                    ISet<Option> allOptionsHashSet = new HashSet<Option>(Enum.GetValues(typeof
(Option)).Cast<Option>());
+                    TestTerms(fieldsProducer, allOptionsHashSet, allOptions[i], options,
true);
+                    if (withPayloads)
+                    {
+                        // If we indexed w/ payloads, also test enums w/o accessing payloads:
+                        ISet<Option> payloadsHashSet = new HashSet<Option>()
{Option.PAYLOADS};
+                        var complementHashSet = new HashSet<Option>(allOptionsHashSet.Except(payloadsHashSet));
+                        TestTerms(fieldsProducer, complementHashSet, allOptions[i], options,
true);
+                    }
                 }
-            }
 
-            fieldsProducer.Dispose();
-            dir.Dispose();
-            System.IO.Directory.Delete(path.FullName, true);
+                fieldsProducer.Dispose();
+            }
         }
 
-        [Test]
+        [Test, Timeout(300000)]
         public virtual void TestDocsOnly()
         {
             TestFull(FieldInfo.IndexOptions.DOCS_ONLY, false);
         }
 
-        [Test]
+        [Test, Timeout(300000)]
         public virtual void TestDocsAndFreqs()
         {
             TestFull(FieldInfo.IndexOptions.DOCS_AND_FREQS, false);
         }
 
-        [Test]
+        [Test, Timeout(300000)]
         public virtual void TestDocsAndFreqsAndPositions()
         {
             TestFull(FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS, false);
         }
 
-        [Test]
+        [Test, Timeout(300000)]
         public virtual void TestDocsAndFreqsAndPositionsAndPayloads()
         {
             TestFull(FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS, true);
         }
 
-        [Test]
+        [Test, Timeout(300000)]
         public virtual void TestDocsAndFreqsAndPositionsAndOffsets()
         {
             TestFull(FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS, false);
         }
 
-        [Test]
+        [Test, Timeout(300000)]
         public virtual void TestDocsAndFreqsAndPositionsAndOffsetsAndPayloads()
         {
             TestFull(FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS, true);
         }
 
-        [Test]
+        [Test, Timeout(300000)]
         public virtual void TestRandom()
         {
             int iters = 5;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/45133b20/src/Lucene.Net.TestFramework/Index/BaseStoredFieldsFormatTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/BaseStoredFieldsFormatTestCase.cs b/src/Lucene.Net.TestFramework/Index/BaseStoredFieldsFormatTestCase.cs
index ac3613f..ce1144f 100644
--- a/src/Lucene.Net.TestFramework/Index/BaseStoredFieldsFormatTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Index/BaseStoredFieldsFormatTestCase.cs
@@ -418,7 +418,7 @@ namespace Lucene.Net.Index
             dir.Dispose();
         }
 
-        [Test]
+        [Test, Timeout(300000)]
         public void TestEmptyDocs()
         {
             Directory dir = NewDirectory();
@@ -447,7 +447,7 @@ namespace Lucene.Net.Index
             dir.Dispose();
         }
 
-        [Test]
+        [Test, Timeout(300000)]
         public void TestConcurrentReads()
         {
             Directory dir = NewDirectory();
@@ -500,8 +500,8 @@ namespace Lucene.Net.Index
             private readonly BaseStoredFieldsFormatTestCase OuterInstance;
 
             private int NumDocs;
-            private DirectoryReader Rd;
-            private IndexSearcher Searcher;
+            private readonly DirectoryReader Rd;
+            private readonly IndexSearcher Searcher;
             private int ReadsPerThread;
             private AtomicReference<Exception> Ex;
             private int i;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/45133b20/src/Lucene.Net.TestFramework/Index/BaseTermVectorsFormatTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/BaseTermVectorsFormatTestCase.cs b/src/Lucene.Net.TestFramework/Index/BaseTermVectorsFormatTestCase.cs
index 3ed1f1a..b873d41 100644
--- a/src/Lucene.Net.TestFramework/Index/BaseTermVectorsFormatTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Index/BaseTermVectorsFormatTestCase.cs
@@ -125,10 +125,7 @@ namespace Lucene.Net.Index
 
             public static IEnumerable<Options> GetAsEnumer()
             {
-                foreach (Options opt in Enum.GetValues(typeof(Options)))
-                {
-                    yield return opt;
-                }
+                return Enum.GetValues(typeof(Options)).Cast<Options>();
             }
 
             public static IEnumerable<Options> GetAsEnumer(Options startInc, Options
endInc)
@@ -753,34 +750,37 @@ namespace Lucene.Net.Index
             }
         }
 
-        [Test]
+        [Test, Timeout(300000)]
         // different options for the same field
         public virtual void TestMixedOptions()
         {
             int numFields = TestUtil.NextInt(Random(), 1, 3);
-            RandomDocumentFactory docFactory = new RandomDocumentFactory(this, numFields,
10);
-            foreach (Options options1 in ValidOptions())
+            var docFactory = new RandomDocumentFactory(this, numFields, 10);
+            foreach (var options1 in ValidOptions())
             {
-                foreach (Options options2 in ValidOptions())
+                foreach (var options2 in ValidOptions())
                 {
                     if (options1 == options2)
                     {
                         continue;
                     }
-                    Directory dir = NewDirectory();
-                    RandomIndexWriter writer = new RandomIndexWriter(Random(), dir);
-                    RandomDocument doc1 = docFactory.NewDocument(numFields, 20, options1);
-                    RandomDocument doc2 = docFactory.NewDocument(numFields, 20, options2);
-                    writer.AddDocument(AddId(doc1.ToDocument(), "1"));
-                    writer.AddDocument(AddId(doc2.ToDocument(), "2"));
-                    IndexReader reader = writer.Reader;
-                    int doc1ID = DocID(reader, "1");
-                    AssertEquals(doc1, reader.GetTermVectors(doc1ID));
-                    int doc2ID = DocID(reader, "2");
-                    AssertEquals(doc2, reader.GetTermVectors(doc2ID));
-                    reader.Dispose();
-                    writer.Dispose();
-                    dir.Dispose();
+                    using (Directory dir = NewDirectory())
+                    {
+                        using (var writer = new RandomIndexWriter(Random(), dir))
+                        {
+                            RandomDocument doc1 = docFactory.NewDocument(numFields, 20, options1);
+                            RandomDocument doc2 = docFactory.NewDocument(numFields, 20, options2);
+                            writer.AddDocument(AddId(doc1.ToDocument(), "1"));
+                            writer.AddDocument(AddId(doc2.ToDocument(), "2"));
+                            using (IndexReader reader = writer.Reader)
+                            {
+                                int doc1ID = DocID(reader, "1");
+                                AssertEquals(doc1, reader.GetTermVectors(doc1ID));
+                                int doc2ID = DocID(reader, "2");
+                                AssertEquals(doc2, reader.GetTermVectors(doc2ID));
+                            }
+                        }
+                    }
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/45133b20/src/Lucene.Net.Tests/core/Codecs/Lucene3x/TestSurrogates.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Codecs/Lucene3x/TestSurrogates.cs b/src/Lucene.Net.Tests/core/Codecs/Lucene3x/TestSurrogates.cs
index fae3742..0ac1cb9 100644
--- a/src/Lucene.Net.Tests/core/Codecs/Lucene3x/TestSurrogates.cs
+++ b/src/Lucene.Net.Tests/core/Codecs/Lucene3x/TestSurrogates.cs
@@ -336,7 +336,7 @@ namespace Lucene.Net.Codecs.Lucene3x
             }
         }
 
-        [Test]
+        [Test, Timeout(300000)]
         public virtual void TestSurrogatesOrder()
         {
             Directory dir = NewDirectory();
@@ -348,7 +348,7 @@ namespace Lucene.Net.Codecs.Lucene3x
 
             int tc = 0;
 
-            List<Term> fieldTerms = new List<Term>();
+            var fieldTerms = new List<Term>();
 
             for (int f = 0; f < numField; f++)
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/45133b20/src/Lucene.Net.Tests/core/Index/TestByteSlices.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestByteSlices.cs b/src/Lucene.Net.Tests/core/Index/TestByteSlices.cs
index cd58c26..9e264c8 100644
--- a/src/Lucene.Net.Tests/core/Index/TestByteSlices.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestByteSlices.cs
@@ -25,7 +25,7 @@ namespace Lucene.Net.Index
     [TestFixture]
     public class TestByteSlices : LuceneTestCase
     {
-        [Test]
+        [Test, Timeout(300000)]
         public virtual void TestBasic()
         {
             ByteBlockPool pool = new ByteBlockPool(new RecyclingByteBlockAllocator(ByteBlockPool.BYTE_BLOCK_SIZE,
Random().Next(100)));

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/45133b20/src/Lucene.Net.Tests/core/Index/TestConcurrentMergeScheduler.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestConcurrentMergeScheduler.cs b/src/Lucene.Net.Tests/core/Index/TestConcurrentMergeScheduler.cs
index dc9d644..b137300 100644
--- a/src/Lucene.Net.Tests/core/Index/TestConcurrentMergeScheduler.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestConcurrentMergeScheduler.cs
@@ -215,7 +215,7 @@ namespace Lucene.Net.Index
             directory.Dispose();
         }
 
-        [Test]
+        [Test, Timeout(300000)]
         public virtual void TestNoExtraFiles()
         {
             Directory directory = NewDirectory();
@@ -247,7 +247,7 @@ namespace Lucene.Net.Index
             directory.Dispose();
         }
 
-        [Test]
+        [Test, Timeout(300000)]
         public virtual void TestNoWaitClose()
         {
             Directory directory = NewDirectory();
@@ -409,7 +409,7 @@ namespace Lucene.Net.Index
             }
         }
 
-        [Test]
+        [Test, Timeout(300000)]
         public virtual void TestTotalBytesSize()
         {
             Directory d = NewDirectory();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/45133b20/src/Lucene.Net.Tests/core/Index/TestDeletionPolicy.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestDeletionPolicy.cs b/src/Lucene.Net.Tests/core/Index/TestDeletionPolicy.cs
index 04ec9c4..a45f0d7 100644
--- a/src/Lucene.Net.Tests/core/Index/TestDeletionPolicy.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestDeletionPolicy.cs
@@ -665,7 +665,7 @@ namespace Lucene.Net.Index
          * around, through creates.
          */
 
-        [Test]
+        [Test, Timeout(300000)]
         public virtual void TestKeepLastNDeletionPolicyWithCreates()
         {
             const int N = 10;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/45133b20/src/Lucene.Net.Tests/core/Index/TestDirectoryReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestDirectoryReader.cs b/src/Lucene.Net.Tests/core/Index/TestDirectoryReader.cs
index c94ce59..d0d9ef4 100644
--- a/src/Lucene.Net.Tests/core/Index/TestDirectoryReader.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestDirectoryReader.cs
@@ -311,7 +311,7 @@ namespace Lucene.Net.Index
             d.Dispose();
         }
 
-        [Test]
+        [Test, Timeout(40000)]
         public virtual void TestTermVectors()
         {
             Directory d = NewDirectory();


Mime
View raw message