-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Gradual naming convention enforcement. #1743
base: master
Are you sure you want to change the base?
Conversation
private void dumpSuiteNamesOnly(String suiteName) throws IOException { | ||
// Has to be a global unique path (not a temp file because temp files | ||
// are different for each JVM). | ||
Path temporaryFile = Paths.get("c:\\_tmp\\test-naming-exceptions.txt"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm this is effectively a // nocommit
right? I.e. we must find the right place for this to live in the sources?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mike, this patch was just to show how it can be done. And this method only collects test cases for exclusion - it's not used and could be removed since in theory we'd only want to take away from once-generated exceptions file. I left it to show how I collected the list in the first place.
if (!ALLOWED_CONVENTION.matcher(suiteName).matches()) { | ||
// if this class exists on the exception list, leave it. | ||
if (!exceptions.contains("!" + suiteName)) { | ||
throw new AssertionError("Suite must follow Test*.java naming convention: " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm shouldn't it say *Test.java naming convention
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again - this was just to show how it can be done; I used prefix convention because it was mentioned on the list, that's it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK thanks @dweiss ;)
Another few, not sure if these also fail on mainline (though prolly we have seed shifting?):
and this exciting one:
This is an interesting failure, but does not repro on two tries:
Also does not repro, but looks very exciting:
|
Ugh sorry wrong PR! |
@mikemccand I opened #1751 for one of the failures and fixed the cloning issue in main line. I can't reproduce any of the other issues |
lucene/test-framework/src/java/org/apache/lucene/util/VerifyTestClassNamingConvention.java
Show resolved
Hide resolved
@@ -613,6 +613,7 @@ public static TestRuleIgnoreAfterMaxFailures replaceMaxFailureRule(TestRuleIgnor | |||
RuleChain r = RuleChain.outerRule(new TestRuleIgnoreTestSuites()) | |||
.around(ignoreAfterMaxFailures) | |||
.around(suiteFailureMarker = new TestRuleMarkFailure()) | |||
.around(new VerifyTestClassNamingConvention()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: would this convention automatically and always apply to all classes derived from LuceneTestCase
including any non-org.apache
name spaces or would it be possible to opt-out (without an exclusion list) somehow for custom code that might perhaps have chosen a different convention?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just code, anything can be changed... In the example I wrote it can't be turned off.
…st' resolution changes (apache#1745 apache#1790 apache#1890 apache#2032)
…he exception list, disallow TestFooBar.java addition
Resolved Conflicts: lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
This reverts commit 095d7aa.
LUCENE-8626. Here's how you can do it in a progressive, incremental way: make an exception list for existing suites not following the convention, but enforce it on anything new.