NightOwl888 commented on issue #1072: URL: https://github.com/apache/lucenenet/issues/1072#issuecomment-2598872560
I got this to repeat reliably. But, currently the `[Repeat]` attribute has not been customized to reset the `Randomizer` instance for each repeated test execution. It continues using the same instance from the last execution. So, if it takes 323 repeats to cause a failure on one run with a given seed, it will continue to take 323 repeats to execute if that same seed is reapplied. Here is a case that fails reliably with `[Repeat(1000)]`: ``` Option 1: Apply the following assembly-level attributes: [assembly: Lucene.Net.Util.RandomSeed("0xb78a94b3d0d07ab5")] [assembly: NUnit.Framework.SetCulture("ca")] Option 2: Use the following .runsettings file: <RunSettings> <TestRunParameters> <Parameter name="tests:seed" value="0xb78a94b3d0d07ab5" /> <Parameter name="tests:culture" value="ca" /> </TestRunParameters> </RunSettings> Option 3: Create the following lucene.testsettings.json file somewhere between the test assembly and the root of your drive: { "tests": { "seed": "0xb78a94b3d0d07ab5", "culture": "ca" } } ``` After about 5-6 minutes, it will always fail with the same stack trace: ``` Stack Trace: OffsetAttribute.SetOffset(Int32 startOffset, Int32 endOffset) line 50 ShingleFilter.IncrementToken() line 369 ValidatingTokenFilter.IncrementToken() line 86 BaseTokenStreamTestCase.CheckAnalysisConsistency(Random random, Analyzer a, Boolean useCharFilter, String text, Boolean offsetsAreCorrect, Field field) line 956 BaseTokenStreamTestCase.CheckRandomData(Random random, Analyzer a, Int32 iterations, Int32 maxWordLength, Boolean useCharFilter, Boolean simple, Boolean offsetsAreCorrect, RandomIndexWriter iw) line 840 BaseTokenStreamTestCase.CheckRandomData(Random random, Analyzer a, Int32 iterations, Int32 maxWordLength, Boolean simple, Boolean offsetsAreCorrect) line 694 TestRandomChains.TestRandomChains_() line 1171 InvokeStub_TestRandomChains.TestRandomChains_(Object, Object, IntPtr*) MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) ``` So, a better way to repeat (for now) is to run the tests in CI without a `[Repeat]` attribute. When a failure happens there, it will be queued up to fail the first time without the `[Repeat]` attribute. I will check to see whether making a `[Repeat]` and/or a `[FindFirstFailingSeed]` attribute that resets the `Random` instance with a new seed will be easy to achieve. The `Randomizer` class already allows the `Seed` to be set without creating a new instance. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@lucenenet.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org