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: Various test framework fixes
Date Thu, 27 Nov 2014 16:30:31 GMT
Repository: lucenenet
Updated Branches:
  refs/heads/master 0a5ecb022 -> eec73d5c1


Various test framework fixes


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

Branch: refs/heads/master
Commit: 2200e79938ac6de7d002fe3ab8944d3c3cdeb211
Parents: 0735c94
Author: Paul Irwin <paulirwin@gmail.com>
Authored: Tue Nov 25 17:39:32 2014 -0500
Committer: Paul Irwin <paulirwin@gmail.com>
Committed: Tue Nov 25 17:39:32 2014 -0500

----------------------------------------------------------------------
 .../Analysis/LookaheadTokenFilter.cs            |  2 +-
 .../Index/BaseTermVectorsFormatTestCase.cs      |  2 +-
 .../ThreadedIndexingAndSearchingTestCase.cs     | 36 ++++++++++----------
 .../Randomized/Generators/RandomInts.cs         |  4 +--
 .../Search/ShardSearchingTestBase.cs            |  6 ++--
 .../Util/LuceneTestCase.cs                      |  7 ++--
 src/Lucene.Net.TestFramework/Util/TestUtil.cs   |  2 +-
 src/Lucene.Net.Tests/Lucene.Net.Tests.csproj    |  3 ++
 src/Lucene.Net.Tests/core/App.config            |  3 ++
 src/Lucene.Net.Tests/core/AssemblyInfo.cs       |  3 ++
 .../core/Index/TestIndexWriterExceptions.cs     |  6 ++--
 .../core/Index/TestNRTThreads.cs                |  6 ++--
 .../core/Search/TestSearcherManager.cs          |  8 ++---
 .../core/Search/TestShardSearching.cs           |  2 +-
 14 files changed, 52 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2200e799/src/Lucene.Net.TestFramework/Analysis/LookaheadTokenFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Analysis/LookaheadTokenFilter.cs b/src/Lucene.Net.TestFramework/Analysis/LookaheadTokenFilter.cs
index 9b2aee1..03aa101 100644
--- a/src/Lucene.Net.TestFramework/Analysis/LookaheadTokenFilter.cs
+++ b/src/Lucene.Net.TestFramework/Analysis/LookaheadTokenFilter.cs
@@ -86,7 +86,7 @@ namespace Lucene.Net.Analysis
         where T : LookaheadTokenFilter.Position
     {
         protected const bool DEBUG = 
-#if DEBUG
+#if VERBOSE_TEST_LOGGING
             true
 #else
             false

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2200e799/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 49185e6..d772e5d 100644
--- a/src/Lucene.Net.TestFramework/Index/BaseTermVectorsFormatTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Index/BaseTermVectorsFormatTestCase.cs
@@ -737,7 +737,7 @@ namespace Lucene.Net.Index
         [Test]
         public virtual void TestLotsOfFields()
         {
-            RandomDocumentFactory docFactory = new RandomDocumentFactory(this, 5000, 10);
+            RandomDocumentFactory docFactory = new RandomDocumentFactory(this, 500, 10);
             foreach (Options options in ValidOptions())
             {
                 Directory dir = NewDirectory();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2200e799/src/Lucene.Net.TestFramework/Index/ThreadedIndexingAndSearchingTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/ThreadedIndexingAndSearchingTestCase.cs b/src/Lucene.Net.TestFramework/Index/ThreadedIndexingAndSearchingTestCase.cs
index f72b8f8..b21d8ce 100644
--- a/src/Lucene.Net.TestFramework/Index/ThreadedIndexingAndSearchingTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Index/ThreadedIndexingAndSearchingTestCase.cs
@@ -91,7 +91,7 @@ namespace Lucene.Net.Index
         }
 
         // Called once to run searching
-        protected internal abstract void DoSearching(TaskScheduler es, long stopTime);
+        protected internal abstract void DoSearching(TaskScheduler es, DateTime stopTime);
 
         protected internal virtual Directory GetDirectory(Directory @in)
         {
@@ -127,7 +127,7 @@ namespace Lucene.Net.Index
         {
         }
 
-        private ThreadClass[] LaunchIndexingThreads(LineFileDocs docs, int numThreads, long
stopTime, ISet<string> delIDs, ISet<string> delPackIDs, IList<SubDocs> allSubDocs)
+        private ThreadClass[] LaunchIndexingThreads(LineFileDocs docs, int numThreads, DateTime
stopTime, ISet<string> delIDs, ISet<string> delPackIDs, IList<SubDocs> allSubDocs)
         {
             ThreadClass[] threads = new ThreadClass[numThreads];
             for (int thread = 0; thread < numThreads; thread++)
@@ -145,12 +145,12 @@ namespace Lucene.Net.Index
             private readonly ThreadedIndexingAndSearchingTestCase OuterInstance;
 
             private LineFileDocs Docs;
-            private long StopTime;
+            private DateTime StopTime;
             private ISet<string> DelIDs;
             private ISet<string> DelPackIDs;
             private IList<SubDocs> AllSubDocs;
 
-            public ThreadAnonymousInnerClassHelper(ThreadedIndexingAndSearchingTestCase outerInstance,
LineFileDocs docs, long stopTime, ISet<string> delIDs, ISet<string> delPackIDs,
IList<SubDocs> allSubDocs)
+            public ThreadAnonymousInnerClassHelper(ThreadedIndexingAndSearchingTestCase outerInstance,
LineFileDocs docs, DateTime stopTime, ISet<string> delIDs, ISet<string> delPackIDs,
IList<SubDocs> allSubDocs)
             {
                 this.OuterInstance = outerInstance;
                 this.Docs = docs;
@@ -165,7 +165,7 @@ namespace Lucene.Net.Index
                 // TODO: would be better if this were cross thread, so that we make sure
one thread deleting anothers added docs works:
                 IList<string> toDeleteIDs = new List<string>();
                 IList<SubDocs> toDeleteSubDocs = new List<SubDocs>();
-                while (DateTime.Now.Millisecond < StopTime && !OuterInstance.Failed.Get())
+                while (DateTime.UtcNow < StopTime && !OuterInstance.Failed.Get())
                 {
                     try
                     {
@@ -389,7 +389,7 @@ namespace Lucene.Net.Index
             }
         }
 
-        protected internal virtual void RunSearchThreads(long stopTimeMS)
+        protected internal virtual void RunSearchThreads(DateTime stopTime)
         {
             int numThreads = TestUtil.NextInt(Random(), 1, 5);
             ThreadClass[] searchThreads = new ThreadClass[numThreads];
@@ -401,7 +401,7 @@ namespace Lucene.Net.Index
             // TODO: we should enrich this to do more interesting searches
             for (int thread = 0; thread < searchThreads.Length; thread++)
             {
-                searchThreads[thread] = new ThreadAnonymousInnerClassHelper2(this, stopTimeMS,
totHits, totTermCount);
+                searchThreads[thread] = new ThreadAnonymousInnerClassHelper2(this, stopTime,
totHits, totTermCount);
                 searchThreads[thread].SetDaemon(true);
                 searchThreads[thread].Start();
             }
@@ -421,14 +421,14 @@ namespace Lucene.Net.Index
         {
             private readonly ThreadedIndexingAndSearchingTestCase OuterInstance;
 
-            private long StopTimeMS;
+            private DateTime StopTime;
             private AtomicInteger TotHits;
             private AtomicInteger TotTermCount;
 
-            public ThreadAnonymousInnerClassHelper2(ThreadedIndexingAndSearchingTestCase
outerInstance, long stopTimeMS, AtomicInteger totHits, AtomicInteger totTermCount)
+            public ThreadAnonymousInnerClassHelper2(ThreadedIndexingAndSearchingTestCase
outerInstance, DateTime stopTime, AtomicInteger totHits, AtomicInteger totTermCount)
             {
                 this.OuterInstance = outerInstance;
-                this.StopTimeMS = stopTimeMS;
+                this.StopTime = stopTime;
                 this.TotHits = totHits;
                 this.TotTermCount = totTermCount;
             }
@@ -439,7 +439,7 @@ namespace Lucene.Net.Index
                 {
                     Console.WriteLine(Thread.CurrentThread.Name + ": launch search thread");
                 }
-                while (DateTime.Now.Millisecond < StopTimeMS)
+                while (DateTime.UtcNow < StopTime)
                 {
                     try
                     {
@@ -488,7 +488,7 @@ namespace Lucene.Net.Index
                                     trigger = TotTermCount.Get() / 30;
                                     shift = Random().Next(trigger);
                                 }
-                                while (DateTime.Now.Millisecond < StopTimeMS)
+                                while (DateTime.UtcNow < StopTime)
                                 {
                                     BytesRef term = termsEnum.Next();
                                     if (term == null)
@@ -547,7 +547,7 @@ namespace Lucene.Net.Index
             DelCount.Set(0);
             PackCount.Set(0);
 
-            long t0 = DateTime.Now.Millisecond;
+            DateTime t0 = DateTime.UtcNow;
 
             Random random = new Random(Random().Next());
             LineFileDocs docs = new LineFileDocs(random, DefaultCodecSupportsDocValues());
@@ -603,13 +603,13 @@ namespace Lucene.Net.Index
             ISet<string> delPackIDs = new ConcurrentHashSet<string>(new HashSet<string>());
             IList<SubDocs> allSubDocs = new ConcurrentList<SubDocs>(new List<SubDocs>());
 
-            long stopTime = DateTime.Now.Millisecond + RUN_TIME_SEC * 1000;
+            DateTime stopTime = DateTime.UtcNow.AddSeconds(RUN_TIME_SEC);
 
             ThreadClass[] indexThreads = LaunchIndexingThreads(docs, NUM_INDEX_THREADS, stopTime,
delIDs, delPackIDs, allSubDocs);
 
             if (VERBOSE)
             {
-                Console.WriteLine("TEST: DONE start " + NUM_INDEX_THREADS + " indexing threads
[" + (DateTime.Now.Millisecond - t0) + " ms]");
+                Console.WriteLine("TEST: DONE start " + NUM_INDEX_THREADS + " indexing threads
[" + (DateTime.UtcNow - t0).TotalMilliseconds + " ms]");
             }
 
             // Let index build up a bit
@@ -619,7 +619,7 @@ namespace Lucene.Net.Index
 
             if (VERBOSE)
             {
-                Console.WriteLine("TEST: all searching done [" + (DateTime.Now.Millisecond
- t0) + " ms]");
+                Console.WriteLine("TEST: all searching done [" + (DateTime.UtcNow - t0).TotalMilliseconds
+ " ms]");
             }
 
             for (int thread = 0; thread < indexThreads.Length; thread++)
@@ -629,7 +629,7 @@ namespace Lucene.Net.Index
 
             if (VERBOSE)
             {
-                Console.WriteLine("TEST: done join indexing threads [" + (DateTime.Now.Millisecond
- t0) + " ms]; addCount=" + AddCount + " delCount=" + DelCount);
+                Console.WriteLine("TEST: done join indexing threads [" + (DateTime.UtcNow
- t0).TotalMilliseconds + " ms]; addCount=" + AddCount + " delCount=" + DelCount);
             }
 
             IndexSearcher s = FinalSearcher;
@@ -767,7 +767,7 @@ namespace Lucene.Net.Index
 
             if (VERBOSE)
             {
-                Console.WriteLine("TEST: done [" + (DateTime.Now.Millisecond - t0) + " ms]");
+                Console.WriteLine("TEST: done [" + (DateTime.UtcNow - t0).TotalMilliseconds
+ " ms]");
             }
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2200e799/src/Lucene.Net.TestFramework/Randomized/Generators/RandomInts.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Randomized/Generators/RandomInts.cs b/src/Lucene.Net.TestFramework/Randomized/Generators/RandomInts.cs
index edc36d3..f3704a9 100644
--- a/src/Lucene.Net.TestFramework/Randomized/Generators/RandomInts.cs
+++ b/src/Lucene.Net.TestFramework/Randomized/Generators/RandomInts.cs
@@ -39,12 +39,12 @@ namespace Lucene.Net.Randomized.Generators
 
         public static T RandomFrom<T>(Random rand, ISet<T> set)
         {
-            return set.ElementAt(rand.Next(0, set.Count - 1));
+            return set.ElementAt(rand.Next(0, set.Count));
         }
 
         public static T RandomFrom<T>(Random rand, IList<T> set)
         {
-            return set.ElementAt(rand.Next(0, set.Count - 1));
+            return set.ElementAt(rand.Next(0, set.Count));
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2200e799/src/Lucene.Net.TestFramework/Search/ShardSearchingTestBase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Search/ShardSearchingTestBase.cs b/src/Lucene.Net.TestFramework/Search/ShardSearchingTestBase.cs
index 9297798..b0a306c 100644
--- a/src/Lucene.Net.TestFramework/Search/ShardSearchingTestBase.cs
+++ b/src/Lucene.Net.TestFramework/Search/ShardSearchingTestBase.cs
@@ -663,7 +663,7 @@ namespace Lucene.Net.Search
                 {
                     LineFileDocs docs = new LineFileDocs(Random(), DefaultCodecSupportsDocValues());
                     int numDocs = 0;
-                    while (TimeHelper.NanoTime() < OuterInstance.EndTimeNanos)
+                    while (DateTime.UtcNow < OuterInstance.EndTime)
                     {
                         int what = Random().Next(3);
                         NodeState node = OuterInstance.Nodes[Random().Next(OuterInstance.Nodes.Length)];
@@ -705,12 +705,12 @@ namespace Lucene.Net.Search
 
         protected internal NodeState[] Nodes;
         internal int MaxSearcherAgeSeconds;
-        protected long EndTimeNanos;
+        protected DateTime EndTime;
         private ThreadClass ChangeIndicesThread;
 
         protected internal virtual void Start(int numNodes, double runTimeSec, int maxSearcherAgeSeconds)
         {
-            EndTimeNanos = TimeHelper.NanoTime() + (long)(runTimeSec * 1000000000);
+            EndTime = DateTime.UtcNow.AddSeconds(runTimeSec);
             this.MaxSearcherAgeSeconds = maxSearcherAgeSeconds;
 
             Nodes = new NodeState[numNodes];

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2200e799/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
index b706748..0abe721 100644
--- a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
@@ -651,7 +651,7 @@ namespace Lucene.Net.Util
         /// </summary>
         public static Random Random()
         {
-            return new Random(1);
+            return new Random();
             //return RandomizedContext.Current.Random;
         }
 
@@ -1409,7 +1409,10 @@ namespace Lucene.Net.Util
                 }
             }
 
-            Trace.TraceInformation("Type of Directory is : {0}", clazzName);
+            if (VERBOSE)
+            {
+                Trace.TraceInformation("Type of Directory is : {0}", clazzName);
+            }
 
             Type clazz = CommandLineUtil.LoadDirectoryClass(clazzName);
             // If it is a FSDirectory type, try its ctor(File)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2200e799/src/Lucene.Net.TestFramework/Util/TestUtil.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/TestUtil.cs b/src/Lucene.Net.TestFramework/Util/TestUtil.cs
index d76e0c3..5dadc39 100644
--- a/src/Lucene.Net.TestFramework/Util/TestUtil.cs
+++ b/src/Lucene.Net.TestFramework/Util/TestUtil.cs
@@ -374,7 +374,7 @@ namespace Lucene.Net.Util
 
         public static string RandomSimpleString(Random r)
         {
-            return RandomSimpleString(r, 0, 10);
+            return RandomSimpleString(r, 0, 20);
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2200e799/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
index ad426d0..57f83ca 100644
--- a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
+++ b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
@@ -633,6 +633,9 @@
     <Folder Include="core\Util\Cache\" />
     <Folder Include="core\Util\Junitcompat\" />
   </ItemGroup>
+  <ItemGroup>
+    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSHARP.Targets" />
   <ProjectExtensions>
     <VisualStudio AllowExistingFolder="true" />

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2200e799/src/Lucene.Net.Tests/core/App.config
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/App.config b/src/Lucene.Net.Tests/core/App.config
index 6cbcd7e..909b15d 100644
--- a/src/Lucene.Net.Tests/core/App.config
+++ b/src/Lucene.Net.Tests/core/App.config
@@ -41,4 +41,7 @@
       </providers>
     </roleManager>
   </system.web>
+  <system.diagnostics>
+    <assert assertuienabled="false" />
+  </system.diagnostics>
 </configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2200e799/src/Lucene.Net.Tests/core/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/AssemblyInfo.cs b/src/Lucene.Net.Tests/core/AssemblyInfo.cs
index dd5cb43..f64ca91 100644
--- a/src/Lucene.Net.Tests/core/AssemblyInfo.cs
+++ b/src/Lucene.Net.Tests/core/AssemblyInfo.cs
@@ -19,6 +19,7 @@
  *
 */
 
+using NUnit.Framework;
 using System.Reflection;
 using System.Runtime.CompilerServices;
 
@@ -80,3 +81,5 @@ using System.Runtime.CompilerServices;
 [assembly: AssemblyDelaySign(false)]
 [assembly: AssemblyKeyFile("")]
 [assembly: AssemblyKeyName("")]
+
+[assembly: Timeout(20000)]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2200e799/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs b/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs
index 97048c8..2268432 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexWriterExceptions.cs
@@ -161,6 +161,8 @@ namespace Lucene.Net.Index
 
         private class IndexerThread : ThreadClass
         {
+            private DateTime unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
+
             private readonly TestIndexWriterExceptions OuterInstance;
 
             internal IndexWriter Writer;
@@ -203,7 +205,7 @@ namespace Lucene.Net.Index
                 Field idField = NewField(r, "id", "", DocCopyIterator.Custom2);
                 doc.Add(idField);
 
-                long stopTime = DateTime.Now.Millisecond + 500;
+                long stopTime = ((long)(DateTime.UtcNow - unixEpoch).TotalMilliseconds) +
500;
 
                 do
                 {
@@ -269,7 +271,7 @@ namespace Lucene.Net.Index
                         Failure = t;
                         break;
                     }
-                } while (DateTime.Now.Millisecond < stopTime);
+                } while (((long)(DateTime.UtcNow - unixEpoch).TotalMilliseconds) < stopTime);
             }
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2200e799/src/Lucene.Net.Tests/core/Index/TestNRTThreads.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestNRTThreads.cs b/src/Lucene.Net.Tests/core/Index/TestNRTThreads.cs
index 0bea57a..658d9f3 100644
--- a/src/Lucene.Net.Tests/core/Index/TestNRTThreads.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestNRTThreads.cs
@@ -45,13 +45,13 @@ namespace Lucene.Net.Index
             UseNonNrtReaders = Random().NextBoolean();
         }
 
-        protected override void DoSearching(TaskScheduler es, long stopTime)
+        protected override void DoSearching(TaskScheduler es, DateTime stopTime)
         {
             bool anyOpenDelFiles = false;
 
             DirectoryReader r = DirectoryReader.Open(Writer, true);
 
-            while (DateTime.Now.Millisecond < stopTime && !Failed.Get())
+            while (DateTime.UtcNow < stopTime && !Failed.Get())
             {
                 if (Random().NextBoolean())
                 {
@@ -98,7 +98,7 @@ namespace Lucene.Net.Index
                 {
                     FixedSearcher = new IndexSearcher(r, es);
                     SmokeTestSearcher(FixedSearcher);
-                    RunSearchThreads(DateTime.Now.Millisecond + 500);
+                    RunSearchThreads(DateTime.UtcNow.AddMilliseconds(500));
                 }
             }
             r.Dispose();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2200e799/src/Lucene.Net.Tests/core/Search/TestSearcherManager.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestSearcherManager.cs b/src/Lucene.Net.Tests/core/Search/TestSearcherManager.cs
index 9c249e2..5b0122d 100644
--- a/src/Lucene.Net.Tests/core/Search/TestSearcherManager.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestSearcherManager.cs
@@ -118,7 +118,7 @@ namespace Lucene.Net.Search
             }
         }
 
-        protected override void DoSearching(TaskScheduler es, long stopTime)
+        protected override void DoSearching(TaskScheduler es, DateTime stopTime)
         {
             ThreadClass reopenThread = new ThreadAnonymousInnerClassHelper(this, stopTime);
             reopenThread.SetDaemon(true);
@@ -133,9 +133,9 @@ namespace Lucene.Net.Search
         {
             private readonly TestSearcherManager OuterInstance;
 
-            private long StopTime;
+            private DateTime StopTime;
 
-            public ThreadAnonymousInnerClassHelper(TestSearcherManager outerInstance, long
stopTime)
+            public ThreadAnonymousInnerClassHelper(TestSearcherManager outerInstance, DateTime
stopTime)
             {
                 this.OuterInstance = outerInstance;
                 this.StopTime = stopTime;
@@ -150,7 +150,7 @@ namespace Lucene.Net.Search
                         Console.WriteLine("[" + Thread.CurrentThread.Name + "]: launch reopen
thread");
                     }
 
-                    while (DateTime.Now.Millisecond < StopTime)
+                    while (DateTime.UtcNow < StopTime)
                     {
                         Thread.Sleep(TestUtil.NextInt(Random(), 1, 100));
                         OuterInstance.Writer.Commit();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2200e799/src/Lucene.Net.Tests/core/Search/TestShardSearching.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestShardSearching.cs b/src/Lucene.Net.Tests/core/Search/TestShardSearching.cs
index 67b31c3..ba4b406 100644
--- a/src/Lucene.Net.Tests/core/Search/TestShardSearching.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestShardSearching.cs
@@ -87,7 +87,7 @@ namespace Lucene.Net.Search
 
             List<PreviousSearchState> priorSearches = new List<PreviousSearchState>();
             List<BytesRef> terms = null;
-            while (TimeHelper.NanoTime() < EndTimeNanos)
+            while (DateTime.UtcNow < EndTime)
             {
                 bool doFollowon = priorSearches.Count > 0 && Random().Next(7)
== 1;
 


Mime
View raw message