[ 
https://issues.apache.org/jira/browse/CASSANDRA-17964?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17619236#comment-17619236
 ] 

Berenguer Blasi edited comment on CASSANDRA-17964 at 10/18/22 6:50 AM:
-----------------------------------------------------------------------

Shouldn't we use this one? 
https://checkstyle.sourceforge.io/apidocs/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpOnFilenameCheck.html
 Seems to do everything we need including negating the match etc? 

IIUC this checks for files with 'Test' in their name and not ending in ' 
Test.java'. Seems we have indeed at least a few splitted tests that weren't 
running

{noformat}
  <module name="RegexpOnFilename">
    <property name="fileNamePattern" value=".*Test.*[^.]\.java"/>
  </module>
{noformat}

Let me see if I can find a way to not do a big rename:

Edit: IIUC

{noformat}
(?!.*Tester.*)(.*Test+.*[^.]\.java)
{noformat}

Does what we need:
- Fails when we need to
- We can use the word 'Tester' safely in all those '*BaseTester' files we have.
- I would rename to 'Tester' all files that may need it
- Avoid us having to deal with types inside files and focuses on the file name
- We can add a custom fail message suggesting to rename to 'Tester' and why it 
failed such as <message key="regexp.filename.mismatch" value="Careful this file 
may not be ran as a test, if you want it ran rename to *Test.java otherwise to 
*Tester*.java'"/>

or sthg along those lines. Wdyt?


was (Author: bereng):
Shouldn't we use this one? 
https://checkstyle.sourceforge.io/apidocs/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpOnFilenameCheck.html
 Seems to do everything we need including negating the match etc? 

IIUC this checks for files with 'Test' in their name and not ending in ' 
Test.java'. Seems we have indeed at least a few splitted tests that weren't 
running

{noformat}
  <module name="RegexpOnFilename">
    <property name="fileNamePattern" value=".*Test.*[^.]\.java"/>
  </module>
{noformat}

Let me see if I can find a way to not do a big rename:

Edit: IIUC {{(?!.*Tester.*)(.*Test+.*[^.]\.java)}} does what we need:
- Fails when we need to
- We can use the word 'Tester' safely in all those '*BaseTester' files we have.
- I would rename to 'Tester' all files that may need it
- Avoid us having to deal with types inside files and focuses on the file name
- We can add a custom fail message suggesting to rename to 'Tester' and why it 
failed such as <message key="regexp.filename.mismatch" value="Careful this file 
may not be ran as a test, if you want it ran rename to *Test.java otherwise to 
*Tester*.java'"/>

or sthg along those lines. Wdyt?

> Some tests are never executed due to naming violation - fix it and add 
> checkstyle where applicable
> --------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-17964
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-17964
>             Project: Cassandra
>          Issue Type: Task
>          Components: Test/unit
>            Reporter: Ruslan Fomkin
>            Assignee: Stefan Miklosovic
>            Priority: Normal
>             Fix For: 3.0.x, 3.11.x, 4.0.x, 4.1.x, 4.x
>
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> [BatchTests|https://github.com/apache/cassandra/blob/trunk/test/unit/org/apache/cassandra/cql3/BatchTests.java]
>  doesn't follow naming convention to be run as unit tests and, thus, is never 
> run.
> The rule in build expects names as `*Test`.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to