Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjustments for enabling nightly builds #355

Merged
merged 21 commits into from
Sep 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
ae79dc0
Lucene.Net.Tests.Facet.Taxonomy.TestSearcherTaxonomyManager: Reduced …
NightOwl888 Sep 24, 2020
df8fbb8
Lucene.Net.Tests.Index.TestBagOfPositions: Reduced numTerms by a fact…
NightOwl888 Sep 24, 2020
fff3583
Lucene.Net.Tests.Index.TestBagOfPostings: Reduced numTerms by a facto…
NightOwl888 Sep 25, 2020
a34e696
Lucene.Net.Tests.Index.Test2BPostings: Ignored test because it pushes…
NightOwl888 Sep 24, 2020
0b0485a
Lucene.Net.TestFramework.Index.ThreadedIndexingAndSearchingTestCase: …
NightOwl888 Sep 24, 2020
dbf9041
Lucene.Net.Tests.Facet.Taxonomy.TestSearcherTaxonomyManager: Reduced …
NightOwl888 Sep 24, 2020
614396c
Lucene.Net.TestFramework.Util.LuceneTestCase::Rarely(): Reduced night…
NightOwl888 Sep 24, 2020
8276b0e
Lucene.Net.Tests.Index.Test4GBStoredFields: Added exception because t…
NightOwl888 Sep 25, 2020
825e57a
Lucene.Net.Tests.Facet: Don't use NO_OP_CACHE during Nightly builds t…
NightOwl888 Sep 25, 2020
481ebb9
Lucene.Net.TestFramework.Util.LuceneTestCase: Reduced AtLeast() facto…
NightOwl888 Sep 25, 2020
147eede
Lucene.Net.Tests.TestFramework.Analysis (TestLookaheadTokenFilter + T…
NightOwl888 Sep 25, 2020
b071ffb
azure-pipelines.yml: Added x86 nightly tests for netcoreapp3.1 and ne…
NightOwl888 Sep 25, 2020
61a59ed
Added [Timeout] attribute on tests that have [Deadlock] attribute to …
NightOwl888 Sep 25, 2020
f2b31b6
Lucene.Net.Tests: Added logging in TestDuringAddIndexes() and TestTer…
NightOwl888 Sep 25, 2020
97991f2
Lucene.Net.TestFramework.Index.BaseStoredFieldsFormatTestCase::TestBi…
NightOwl888 Sep 26, 2020
bcf4064
publish-test-results.yml: Removed call to show-all-files.yml that is …
NightOwl888 Sep 26, 2020
09264bb
Lucene.Net.Tests.Index.TestFlushByRamOrCountsPolicy::TestFlushByRam()…
NightOwl888 Sep 26, 2020
bd437b2
Lucene.Net.Tests.Index: Added TimeoutAttribute on several Nightly tes…
NightOwl888 Sep 26, 2020
3020b67
Added TimeoutAttribute at the assembly level of tests to stop tests a…
NightOwl888 Sep 26, 2020
c66bf9f
Lucene.Net.Tests.Facet.Taxonomy.TestSearcherTaxonomyManger::Test_Dire…
NightOwl888 Sep 26, 2020
39331ed
Lucene.Net.Tests.Index.TestDocumentsWriterStallControl::TestAccquireR…
NightOwl888 Sep 26, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 66 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ stages:
- stage: Test_Stage
displayName: 'Test Stage:'
jobs:
- job: Test_netcoreapp3_1
- job: Test_netcoreapp3_1_x64
condition: and(succeeded(), ne(variables['RunTests'], 'false'))
strategy:
matrix:
Expand Down Expand Up @@ -325,7 +325,39 @@ stages:
maximumParallelJobs: $(maximumParallelJobs)
maximumAllowedFailures: $(maximumAllowedFailures)

- job: Test_netcoreapp2_2
- job: Test_netcoreapp3_1_x86 # Only run Nightly
condition: and(succeeded(), ne(variables['RunTests'], 'false'), eq(variables['IsNightly'], 'true'))
strategy:
matrix:
Windows:
osName: 'Windows'
imageName: 'windows-2019'
maximumParallelJobs: 8
maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
Linux:
osName: 'Linux'
imageName: 'ubuntu-16.04'
maximumParallelJobs: 7
maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
macOS:
osName: 'macOS'
imageName: 'macOS-10.14'
maximumParallelJobs: 7
maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
displayName: 'Test netcoreapp3.1,x86 on'
pool:
vmImage: $(imageName)
steps:
- template: 'build/azure-templates/run-tests-on-os.yml'
parameters:
osName: $(osName)
framework: 'netcoreapp3.1'
vsTestPlatform: 'x86'
testResultsArtifactName: '$(TestResultsArtifactName)'
maximumParallelJobs: $(maximumParallelJobs)
maximumAllowedFailures: $(maximumAllowedFailures)

- job: Test_netcoreapp2_2_x64
condition: and(succeeded(), ne(variables['RunTests'], 'false'))
strategy:
matrix:
Expand Down Expand Up @@ -357,6 +389,38 @@ stages:
maximumParallelJobs: $(maximumParallelJobs)
maximumAllowedFailures: $(maximumAllowedFailures)

- job: Test_netcoreapp2_2_x86 # Only run Nightly
condition: and(succeeded(), ne(variables['RunTests'], 'false'), eq(variables['IsNightly'], 'true'))
strategy:
matrix:
Windows:
osName: 'Windows'
imageName: 'windows-2019'
maximumParallelJobs: 8
maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
Linux:
osName: 'Linux'
imageName: 'ubuntu-16.04'
maximumParallelJobs: 7
maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
macOS:
osName: 'macOS'
imageName: 'macOS-10.14'
maximumParallelJobs: 7
maximumAllowedFailures: 4 # Maximum allowed failures for a successful build
displayName: 'Test netcoreapp2.1,x86 on'
pool:
vmImage: $(imageName)
steps:
- template: 'build/azure-templates/run-tests-on-os.yml'
parameters:
osName: $(osName)
framework: 'netcoreapp2.1'
vsTestPlatform: 'x86'
testResultsArtifactName: '$(TestResultsArtifactName)'
maximumParallelJobs: $(maximumParallelJobs)
maximumAllowedFailures: $(maximumAllowedFailures)

- job: Test_net48_Windows_x64
condition: and(succeeded(), ne(variables['RunTests'], 'false'))
displayName: 'Test net48,x64 on Windows'
Expand Down
2 changes: 1 addition & 1 deletion build/azure-templates/publish-test-results.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ steps:
# EnsureNotNullOrEmpty('${{ parameters.testResultsFileName }}', 'testResultsFileName')
# displayName: 'Validate Template Parameters'

- template: 'show-all-files.yml' # Uncomment for debugging
#- template: 'show-all-files.yml' # Uncomment for debugging

- powershell: |
$testResultsFileName = "$(Build.ArtifactStagingDirectory)/${{ parameters.testResultsArtifactName }}/${{ parameters.osName }}/${{ parameters.framework }}/${{ parameters.vsTestPlatform }}/${{ parameters.testProjectName }}/${{ parameters.testResultsFileName }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,10 @@ public virtual void TestBigDocuments()
using (Directory dir = new MockDirectoryWrapper(Random, new MMapDirectory(CreateTempDir("testBigDocuments"))))
{
IndexWriterConfig iwConf = NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random));
iwConf.SetMaxBufferedDocs(RandomInts.RandomInt32Between(Random, 2, 30));
//iwConf.SetMaxBufferedDocs(RandomInts.RandomInt32Between(Random, 2, 30));
// LUCENENET specific - Reduced amount to keep the total
// Nightly test time under 1 hour
iwConf.SetMaxBufferedDocs(RandomInts.RandomInt32Between(Random, 2, 15));
using (RandomIndexWriter iw = new RandomIndexWriter(Random, dir, iwConf))
{

Expand All @@ -767,13 +770,19 @@ public virtual void TestBigDocuments()
onlyStored.IsIndexed = false;

Field smallField = new Field("fld", RandomByteArray(Random.Next(10), 256), onlyStored);
int numFields = RandomInts.RandomInt32Between(Random, 500000, 1000000);
//int numFields = RandomInts.RandomInt32Between(Random, 500000, 1000000);
// LUCENENET specific - Reduced amount to keep the total
// Nightly test time under 1 hour
int numFields = RandomInts.RandomInt32Between(Random, 250000, 500000);
for (int i = 0; i < numFields; ++i)
{
bigDoc1.Add(smallField);
}

Field bigField = new Field("fld", RandomByteArray(RandomInts.RandomInt32Between(Random, 1000000, 5000000), 2), onlyStored);
//Field bigField = new Field("fld", RandomByteArray(RandomInts.RandomInt32Between(Random, 1000000, 5000000), 2), onlyStored);
// LUCENENET specific - Reduced amount to keep the total
// Nightly test time under 1 hour
Field bigField = new Field("fld", RandomByteArray(RandomInts.RandomInt32Between(Random, 500000, 2500000), 2), onlyStored);
bigDoc2.Add(bigField);

int numDocs = AtLeast(5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,10 @@ public override void Run()
{
Console.WriteLine(Thread.CurrentThread.Name + ": now long sleep");
}
Thread.Sleep(TestUtil.NextInt32(Random, 50, 500));
//Thread.Sleep(TestUtil.NextInt32(Random, 50, 500));
// LUCENENET specific - Reduced amount of pause to keep the total
// Nightly test time under 1 hour
Thread.Sleep(TestUtil.NextInt32(Random, 50, 250));
}

// Rate limit ingest rate:
Expand Down Expand Up @@ -585,15 +588,18 @@ public virtual void RunTest(string testName)
MergePolicy mp = conf.MergePolicy;
if (mp is TieredMergePolicy)
{
((TieredMergePolicy)mp).MaxMergedSegmentMB = 5000.0;
//((TieredMergePolicy)mp).MaxMergedSegmentMB = 5000.0;
((TieredMergePolicy)mp).MaxMergedSegmentMB = 2500.0; // LUCENENET specific - reduced each number by 50% to keep testing time under 1 hour
}
else if (mp is LogByteSizeMergePolicy)
{
((LogByteSizeMergePolicy)mp).MaxMergeMB = 1000.0;
//((LogByteSizeMergePolicy)mp).MaxMergeMB = 1000.0;
((LogByteSizeMergePolicy)mp).MaxMergeMB = 500.0; // LUCENENET specific - reduced each number by 50% to keep testing time under 1 hour
}
else if (mp is LogMergePolicy)
{
((LogMergePolicy)mp).MaxMergeDocs = 100000;
//((LogMergePolicy)mp).MaxMergeDocs = 100000;
((LogMergePolicy)mp).MaxMergeDocs = 50000; // LUCENENET specific - reduced each number by 50% to keep testing time under 1 hour
}
}

Expand All @@ -612,7 +618,10 @@ public virtual void RunTest(string testName)

int NUM_INDEX_THREADS = TestUtil.NextInt32(LuceneTestCase.Random, 2, 4);

int RUN_TIME_SEC = LuceneTestCase.TestNightly ? 300 : RandomMultiplier;
//int RUN_TIME_SEC = LuceneTestCase.TestNightly ? 300 : RandomMultiplier;
// LUCENENET specific - lowered from 300 to 150 to reduce total time on Nightly
// build to less than 1 hour.
int RUN_TIME_SEC = LuceneTestCase.TestNightly ? 150 : RandomMultiplier;

ISet<string> delIDs = new ConcurrentHashSet<string>();
ISet<string> delPackIDs = new ConcurrentHashSet<string>();
Expand Down
60 changes: 58 additions & 2 deletions src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1378,7 +1378,10 @@ protected static void AssertSaneFieldCaches(string msg)
/// </summary>
public static int AtLeast(Random random, int i)
{
int min = (TestNightly ? 2 * i : i) * RandomMultiplier;
//int min = (TestNightly ? 2 * i : i) * RandomMultiplier;
// LUCENENET specific - reduced nightly factor to lower the
// total test time in Nightly builds to get under the 1 hour time limit of Azure DevOps
int min = (TestNightly ? (int)(1.5 * i) : i) * RandomMultiplier;
int max = min + (min / 2);
return TestUtil.NextInt32(random, min, max);
}
Expand All @@ -1396,7 +1399,10 @@ public static int AtLeast(int i)
/// </summary>
public static bool Rarely(Random random)
{
int p = TestNightly ? 10 : 1;
//int p = TestNightly ? 10 : 1;
// LUCENENET specific - reduced nightly instance by 1/2 to lower the
// total test time in Nightly builds to get under the 1 hour time limit of Azure DevOps
int p = TestNightly ? 5 : 1;
p += (int)(p * Math.Log(RandomMultiplier));
int min = 100 - Math.Min(p, 50); // never more than 50
return random.Next(100) >= min;
Expand Down Expand Up @@ -3579,6 +3585,56 @@ public static IList<Func<IConcurrentMergeScheduler>> Values
}
}

internal static void LogNativeFSFactoryDebugInfo()
{
// LUCENENET specific - log the current locking strategy used and HResult values
// for assistance troubleshooting problems on Linux/macOS
SystemConsole.WriteLine($"Locking Strategy: {NativeFSLockFactory.LockingStrategy}");
SystemConsole.WriteLine($"Share Violation HResult: {(NativeFSLockFactory.HRESULT_FILE_SHARE_VIOLATION.HasValue ? NativeFSLockFactory.HRESULT_FILE_SHARE_VIOLATION.ToString() : "null")}");
SystemConsole.WriteLine($"Lock Violation HResult: {(NativeFSLockFactory.HRESULT_FILE_LOCK_VIOLATION.HasValue ? NativeFSLockFactory.HRESULT_FILE_LOCK_VIOLATION.ToString() : "null")}");

string fileName;
try
{
// This could throw, but we don't care about this HResult value.
fileName = Path.GetTempFileName();
}
catch (Exception e)
{
SystemConsole.WriteLine($"Error while creating temp file: {e}");
return;
}

Stream lockStream;
try
{
lockStream = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.Write, FileShare.None, 1, FileOptions.None);
}
catch (Exception e)
{
SystemConsole.WriteLine($"Error while opening initial share stream: {e}");
SystemConsole.WriteLine($"******* HResult: {e.HResult}");
return;
}
try
{
// Try to get an exclusive lock on the file - this should throw an IOException with the current platform's HResult value for FileShare violation
using (var stream = new FileStream(fileName, FileMode.Open, FileAccess.Write, FileShare.None, 1, FileOptions.None))
{
}
}
catch (IOException io) when (io.HResult != 0)
{
SystemConsole.WriteLine($"Successfully retrieved sharing violation.");
SystemConsole.WriteLine($"******* HResult: {io.HResult}");
SystemConsole.WriteLine($"Exception: {io}");
}
finally
{
lockStream.Dispose();
}
}

private double nextNextGaussian; // LUCENENET specific
private bool haveNextNextGaussian = false; // LUCENENET specific

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*
*/

using NUnit.Framework;
using System.Reflection;
using System.Runtime.InteropServices;

Expand All @@ -36,3 +37,6 @@
[assembly: Guid("fd602350-abed-4d1e-ad7b-709d18b0b464")]


// LUCENENET specific - time out test projects at 55 minutes to allow the results
// to be uploaded before the 60 minute Azure DevOps job cutoff for easier troubleshooting
[assembly: Timeout(3300000)]
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* limitations under the License.
*/

using NUnit.Framework;
using System.Reflection;
using System.Runtime.InteropServices;

Expand All @@ -31,4 +32,6 @@
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("34a2bce8-1351-43bd-a365-f50e7c0b2c49")]


// LUCENENET specific - time out test projects at 55 minutes to allow the results
// to be uploaded before the 60 minute Azure DevOps job cutoff for easier troubleshooting
[assembly: Timeout(3300000)]
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*
*/

using NUnit.Framework;
using System.Reflection;
using System.Runtime.InteropServices;

Expand All @@ -35,4 +36,6 @@
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a2867797-0a5d-4878-8f59-58c399c9a4e4")]


// LUCENENET specific - time out test projects at 55 minutes to allow the results
// to be uploaded before the 60 minute Azure DevOps job cutoff for easier troubleshooting
[assembly: Timeout(3300000)]
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* limitations under the License.
*/

using NUnit.Framework;
using System.Reflection;
using System.Runtime.InteropServices;

Expand All @@ -31,4 +32,6 @@
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8c8d78d3-bffd-4301-953b-fe5350b2aeeb")]


// LUCENENET specific - time out test projects at 55 minutes to allow the results
// to be uploaded before the 60 minute Azure DevOps job cutoff for easier troubleshooting
[assembly: Timeout(3300000)]
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*
*/

using NUnit.Framework;
using System.Reflection;
using System.Runtime.InteropServices;

Expand All @@ -35,4 +36,6 @@
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("940a6ab1-f00a-40e2-bc1a-2898efa8c48f")]


// LUCENENET specific - time out test projects at 55 minutes to allow the results
// to be uploaded before the 60 minute Azure DevOps job cutoff for easier troubleshooting
[assembly: Timeout(3300000)]
5 changes: 4 additions & 1 deletion src/Lucene.Net.Tests.Benchmark/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/


using NUnit.Framework;
using System.Reflection;
using System.Runtime.InteropServices;

Expand All @@ -32,4 +33,6 @@
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("9257f543-44e2-4db6-8b27-a8a354c13e5b")]


// LUCENENET specific - time out test projects at 55 minutes to allow the results
// to be uploaded before the 60 minute Azure DevOps job cutoff for easier troubleshooting
[assembly: Timeout(3300000)]
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*
*/

using NUnit.Framework;
using System.Reflection;
using System.Runtime.InteropServices;

Expand All @@ -35,4 +36,6 @@
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("253246a8-7b09-4251-ab4c-7971d3b2be4a")]


// LUCENENET specific - time out test projects at 55 minutes to allow the results
// to be uploaded before the 60 minute Azure DevOps job cutoff for easier troubleshooting
[assembly: Timeout(3300000)]
4 changes: 4 additions & 0 deletions src/Lucene.Net.Tests.Codecs/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,7 @@
// LUCENENET specific - only allow tests in this assembly to run one at a time
// to prevent polluting shared state.
[assembly: LevelOfParallelism(1)]

// LUCENENET specific - time out this test project at 50 minutes to allow for time before this
// test runs and the results to be uploaded before the 60 minute Azure DevOps job cutoff for easier troubleshooting
[assembly: Timeout(3000000)]
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Lucene.Net.Attributes;
using Lucene.Net.Index;
using NUnit.Framework;

namespace Lucene.Net.Codecs.SimpleText
{
Expand Down Expand Up @@ -28,7 +29,7 @@ protected override Codec GetCodec()
return new SimpleTextCodec();
}

[Deadlock]
[Deadlock][Timeout(600000)]
public override void TestConcurrentReads()
{
base.TestConcurrentReads();
Expand Down
Loading