You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by sy...@apache.org on 2015/01/05 09:21:09 UTC

lucenenet git commit: Bring in basic support for Nightly / Weekly / AwaitsFix

Repository: lucenenet
Updated Branches:
  refs/heads/master 39ae8f9f0 -> ee7ef249c


Bring in basic support for Nightly / Weekly / AwaitsFix

This would have been smarter if NUnit's attributes would have any power at all. Currently they are just being used as markers and interpretted by the NUnit core using reflection. This sucks and we need to find a way around that soon.


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

Branch: refs/heads/master
Commit: ee7ef249ca5efffb896743bd14bf4e4a00a40cd5
Parents: 39ae8f9
Author: Itamar Syn-Hershko <it...@code972.com>
Authored: Mon Jan 5 10:20:49 2015 +0200
Committer: Itamar Syn-Hershko <it...@code972.com>
Committed: Mon Jan 5 10:20:49 2015 +0200

----------------------------------------------------------------------
 .../Attributes/AwaitsFixAttribute.cs            | 19 ++++++++
 .../Attributes/NightlyAttribute.cs              | 14 ++++++
 .../Attributes/WeeklyAttribute.cs               | 14 ++++++
 .../Index/BaseStoredFieldsFormatTestCase.cs     |  4 +-
 .../Lucene.Net.TestFramework.csproj             |  3 ++
 .../Util/LuceneTestCase.cs                      | 49 +-------------------
 .../core/Index/Test2BPostings.cs                |  4 +-
 .../core/Index/TestIndexWriterDelete.cs         |  4 +-
 .../core/Store/TestDirectory.cs                 |  4 +-
 .../core/Store/TestLockFactory.cs               |  8 ++--
 10 files changed, 62 insertions(+), 61 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ee7ef249/src/Lucene.Net.TestFramework/Attributes/AwaitsFixAttribute.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Attributes/AwaitsFixAttribute.cs b/src/Lucene.Net.TestFramework/Attributes/AwaitsFixAttribute.cs
new file mode 100644
index 0000000..3b9f9b5
--- /dev/null
+++ b/src/Lucene.Net.TestFramework/Attributes/AwaitsFixAttribute.cs
@@ -0,0 +1,19 @@
+using System;
+using NUnit.Framework;
+
+namespace Lucene.Net.Attributes
+{
+    [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = false)]    
+    public class AwaitsFixAttribute : ExplicitAttribute
+    {
+        public AwaitsFixAttribute() : base("Awaits fix")
+        {
+            
+        }
+
+        /// <summary>
+        /// Point to JIRA / GitHub entry.
+        /// </summary>
+        public string BugUrl { get; set; }
+    }
+}

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ee7ef249/src/Lucene.Net.TestFramework/Attributes/NightlyAttribute.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Attributes/NightlyAttribute.cs b/src/Lucene.Net.TestFramework/Attributes/NightlyAttribute.cs
new file mode 100644
index 0000000..496db8b
--- /dev/null
+++ b/src/Lucene.Net.TestFramework/Attributes/NightlyAttribute.cs
@@ -0,0 +1,14 @@
+using System;
+using NUnit.Framework;
+
+namespace Lucene.Net.Attributes
+{
+    [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
+    public class NightlyAttribute : ExplicitAttribute
+    {
+        public NightlyAttribute() : base("Nightly")
+        {
+            
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ee7ef249/src/Lucene.Net.TestFramework/Attributes/WeeklyAttribute.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Attributes/WeeklyAttribute.cs b/src/Lucene.Net.TestFramework/Attributes/WeeklyAttribute.cs
new file mode 100644
index 0000000..4f394bf
--- /dev/null
+++ b/src/Lucene.Net.TestFramework/Attributes/WeeklyAttribute.cs
@@ -0,0 +1,14 @@
+using System;
+using NUnit.Framework;
+
+namespace Lucene.Net.Attributes
+{
+    [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
+    public class WeeklyAttribute : ExplicitAttribute
+    {
+        public WeeklyAttribute() : base("Weekly")
+        {
+            
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ee7ef249/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 7e555ee..7062269 100644
--- a/src/Lucene.Net.TestFramework/Index/BaseStoredFieldsFormatTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Index/BaseStoredFieldsFormatTestCase.cs
@@ -1,4 +1,5 @@
 using Apache.NMS.Util;
+using Lucene.Net.Attributes;
 using Lucene.Net.Codecs;
 using Lucene.Net.Documents;
 using Lucene.Net.Randomized.Generators;
@@ -670,8 +671,7 @@ namespace Lucene.Net.Index
             dir.Dispose();
         }
 
-        [Test]
-        //ORIGINAL LINE: @Nightly public void testBigDocuments() throws java.io.IOException
+        [Test, Nightly, Timeout(int.MaxValue)]
         public void TestBigDocuments()
         {
             // "big" as "much bigger than the chunk size"

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ee7ef249/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj b/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
index d86aae8..87f25bf 100644
--- a/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
+++ b/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
@@ -127,6 +127,9 @@
     <Compile Include="Analysis\VocabularyAssert.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="Attributes\AwaitsFixAttribute.cs" />
+    <Compile Include="Attributes\NightlyAttribute.cs" />
+    <Compile Include="Attributes\WeeklyAttribute.cs" />
     <Compile Include="Codecs\asserting\AssertingCodec.cs">
       <SubType>Code</SubType>
     </Compile>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ee7ef249/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 9779a75..42ce3ee 100644
--- a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
@@ -216,54 +216,7 @@ namespace Lucene.Net.Util
         /// <seealso> cref= #ignoreAfterMaxFailures </seealso>
         public const string SYSPROP_FAILFAST = "tests.failfast";
 
-        public interface Nightly
-        {
-        }
-
-        public interface Weekly
-        {
-        }
-
-        /*/// <summary>
-      /// Annotation for tests that should only be run during nightly builds.
-      /// </summary>
-      public class Nightly : System.Attribute
-      /// <summary>
-      /// Annotation for tests that should only be run during weekly builds
-      /// </summary>
-      {
-          private readonly LuceneTestCase OuterInstance;
-
-          public Nightly(LuceneTestCase outerInstance)
-          {
-              this.OuterInstance = outerInstance;
-          }
-      }
-      public class Weekly : System.Attribute
-      /// <summary>
-      /// Annotation for tests which exhibit a known issue and are temporarily disabled.
-      /// </summary>
-      {
-          private readonly LuceneTestCase OuterInstance;
-
-          public Weekly(LuceneTestCase outerInstance)
-          {
-              this.OuterInstance = outerInstance;
-          }
-      }
-      public class AwaitsFix : System.Attribute
-      {
-          private readonly LuceneTestCase OuterInstance;
-
-          public AwaitsFix(LuceneTestCase outerInstance)
-          {
-              this.OuterInstance = outerInstance;
-          }
-
-        /// <summary>
-        /// Point to JIRA entry. </summary>
-        public string bugUrl();
-      }
+        /*     
 
       /// <summary>
       /// Annotation for tests that are slow. Slow tests do run by default but can be

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ee7ef249/src/Lucene.Net.Tests/core/Index/Test2BPostings.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/Test2BPostings.cs b/src/Lucene.Net.Tests/core/Index/Test2BPostings.cs
index c477fc3..f838102 100644
--- a/src/Lucene.Net.Tests/core/Index/Test2BPostings.cs
+++ b/src/Lucene.Net.Tests/core/Index/Test2BPostings.cs
@@ -1,4 +1,5 @@
 using Lucene.Net.Analysis.Tokenattributes;
+using Lucene.Net.Attributes;
 using Lucene.Net.Documents;
 using NUnit.Framework;
 using System;
@@ -42,8 +43,7 @@ namespace Lucene.Net.Index
     [TestFixture]
     public class Test2BPostings : LuceneTestCase
     {
-        //ORIGINAL LINE: @Nightly public void test() throws Exception
-        [Test]
+        [Test, Nightly, Timeout(int.MaxValue)]
         public virtual void Test()
         {
             BaseDirectoryWrapper dir = NewFSDirectory(CreateTempDir("2BPostings"));

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ee7ef249/src/Lucene.Net.Tests/core/Index/TestIndexWriterDelete.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIndexWriterDelete.cs b/src/Lucene.Net.Tests/core/Index/TestIndexWriterDelete.cs
index 60dff7e..1da1779 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexWriterDelete.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexWriterDelete.cs
@@ -4,6 +4,7 @@ using System.Collections.Generic;
 using System.Diagnostics;
 using System.Text;
 using System.Threading;
+using Lucene.Net.Attributes;
 using Lucene.Net.Documents;
 
 namespace Lucene.Net.Index
@@ -1298,8 +1299,7 @@ namespace Lucene.Net.Index
 
         // Make sure buffered (pushed) deletes don't use up so
         // much RAM that it forces long tail of tiny segments:
-        //ORIGINAL LINE: @Nightly public void testApplyDeletesOnFlush() throws Exception
-        [Test]
+        [Test, Nightly, Timeout(int.MaxValue)]
         public virtual void TestApplyDeletesOnFlush()
         {
             Directory dir = NewDirectory();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ee7ef249/src/Lucene.Net.Tests/core/Store/TestDirectory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Store/TestDirectory.cs b/src/Lucene.Net.Tests/core/Store/TestDirectory.cs
index ef105c6..862d3d1 100644
--- a/src/Lucene.Net.Tests/core/Store/TestDirectory.cs
+++ b/src/Lucene.Net.Tests/core/Store/TestDirectory.cs
@@ -1,3 +1,4 @@
+using Lucene.Net.Attributes;
 using Lucene.Net.Randomized.Generators;
 using Lucene.Net.Support;
 using NUnit.Framework;
@@ -53,8 +54,7 @@ namespace Lucene.Net.Store
 
         // test is occasionally very slow, i dont know why
         // try this seed: 7D7E036AD12927F5:93333EF9E6DE44DE
-        [Ignore]//was marked @nightly
-        [Test]
+        [Test, Nightly, Timeout(int.MaxValue)]
         public virtual void TestThreadSafety()
         {
             BaseDirectoryWrapper dir = NewDirectory();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ee7ef249/src/Lucene.Net.Tests/core/Store/TestLockFactory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Store/TestLockFactory.cs b/src/Lucene.Net.Tests/core/Store/TestLockFactory.cs
index 5d86835..d779d39 100644
--- a/src/Lucene.Net.Tests/core/Store/TestLockFactory.cs
+++ b/src/Lucene.Net.Tests/core/Store/TestLockFactory.cs
@@ -1,3 +1,4 @@
+using Lucene.Net.Attributes;
 using Lucene.Net.Documents;
 using Lucene.Net.Support;
 using NUnit.Framework;
@@ -148,9 +149,7 @@ namespace Lucene.Net.Store
         // Verify: do stress test, by opening IndexReaders and
         // IndexWriters over & over in 2 threads and making sure
         // no unexpected exceptions are raised:
-        //ORIGINAL LINE: @Nightly public void testStressLocks() throws Exception
-        [Ignore]
-        [Test]
+        [Test, Nightly, Timeout(int.MaxValue)]
         public virtual void TestStressLocks()
         {
             _testStressLocks(null, CreateTempDir("index.TestLockFactory6"));
@@ -160,8 +159,7 @@ namespace Lucene.Net.Store
         // IndexWriters over & over in 2 threads and making sure
         // no unexpected exceptions are raised, but use
         // NativeFSLockFactory:
-        [Ignore]//marked @nightly
-        [Test]
+        [Test, Nightly, Timeout(int.MaxValue)]
         public virtual void TestStressLocksNativeFSLockFactory()
         {
             DirectoryInfo dir = CreateTempDir("index.TestLockFactory7");