I think it has a downside: having a bug in an assert is really more of a corner case. This is the kind of thing jenkins is for?
Locally it would be nice for the compile-test-debug loop for the asserts to always be working. Tying it into random seeds is gonna result in tests that behave in crazy ways: I'm thinking about first time contributors and stuff. Not every test is some crazy random one... On Fri, Feb 19, 2021 at 7:08 AM Michael McCandless < luc...@mikemccandless.com> wrote: > Ahh, you are right, Dawid! I thought our test infra had the randomization > of enabling or disabling assertions, but it looks like it is our Jenkins > jobs that contain the randomization. > > Could we somehow move the randomness into our test infrastructure? E.g. > it would have helped Gautam (and other developers in the future) catch that > subtle but nasty bug in his PR during private development rather than later > in random Jenkins runs. If I remember right, we originally added this > randomization precisely because we had such a bug, and the bug got released > and later caught and fixed in a subsequent release. > > Or is that a bad idea for some reason :) > > Mike McCandless > > http://blog.mikemccandless.com > > > On Fri, Feb 19, 2021 at 3:44 AM Dawid Weiss <dawid.we...@gmail.com> wrote: > >> Run, for example: >> >> gradlew -p lucene testOpts >> >> to see the options available. Notice this one: >> >> tests.asserts = true # Enables or disables assertions >> mode. >> >> and run your tests with: >> >> gradlew -p lucene -Ptests.asserts=false test >> >> From IDE level you can disable assertions with -Dtests.asserts=false >> (and not adding -ea). >> >> D. >> >> On Thu, Feb 18, 2021 at 3:45 AM Gautam Worah <worah.gau...@gmail.com> >> wrote: >> > >> > Hi Folks, >> > >> > I was working on PR LUCENE-9476 when we found cases where `asserts` in >> test cases were always enabled. To verify whether this was true, I wrote a >> simple test case that called assert 1000 times, modified a variable and >> then checked its value. This test case always passed because `assert` was >> always enabled. >> > >> > Mike McCandless mentioned in the PR that Lucene earlier had the >> capability to randomly disable `asserts` so that there were no accidental >> cases of developers relying on `asserts` always being enabled. We may have >> lost this feature when the project transitioned to Gradle. >> > When I change the default value of `tests.asserts` in >> randomization.gradle to false, the test fails promptly. >> > >> > Has anyone else noticed this/knows more about this? >> > >> > Thanks, >> > Gautam Worah. >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org >> For additional commands, e-mail: dev-h...@lucene.apache.org >> >>