BUG: Lucene.Net.Tests.Index.TestConcurrentMergeScheduler: Fixed FailOnlyOnFlush class to match the original, which was causing TestFlushExceptions() to fail. Also removed throw statement on a background thread that was causing a crash.
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/37dcb68b Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/37dcb68b Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/37dcb68b Branch: refs/heads/master Commit: 37dcb68b51f7e2913badf1fc796ea11e9c454105 Parents: 0c5239f Author: Shad Storhaug <[email protected]> Authored: Thu Sep 7 05:39:32 2017 +0700 Committer: Shad Storhaug <[email protected]> Committed: Thu Sep 7 05:39:32 2017 +0700 ---------------------------------------------------------------------- src/Lucene.Net.Tests/Index/TestConcurrentMergeScheduler.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/37dcb68b/src/Lucene.Net.Tests/Index/TestConcurrentMergeScheduler.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests/Index/TestConcurrentMergeScheduler.cs b/src/Lucene.Net.Tests/Index/TestConcurrentMergeScheduler.cs index 9ef441f..42df0f6 100644 --- a/src/Lucene.Net.Tests/Index/TestConcurrentMergeScheduler.cs +++ b/src/Lucene.Net.Tests/Index/TestConcurrentMergeScheduler.cs @@ -68,12 +68,12 @@ namespace Lucene.Net.Index public override void Eval(MockDirectoryWrapper dir) { - if (DoFail && TestThread() && Random().NextBoolean()) + if (DoFail && TestThread()) { bool isDoFlush = Util.StackTraceHelper.DoesStackTraceContainMethod("Flush"); bool isClose = Util.StackTraceHelper.DoesStackTraceContainMethod("Close"); - if (isDoFlush && !isClose ) + if (isDoFlush && !isClose && Random().NextBoolean()) { HitExc = true; throw new IOException(Thread.CurrentThread.Name + ": now failing during flush"); @@ -378,7 +378,10 @@ namespace Lucene.Net.Index { Failed.Set(true); m_writer.MergeFinish(merge); - throw new Exception(t.ToString(), t); + + // LUCENENET specific - throwing an exception on a background thread causes the test + // runner to crash on .NET Core 2.0. + //throw new Exception(t.ToString(), t); } } }
