You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Bernardo Botella Corbi (Jira)" <ji...@apache.org> on 2022/05/05 23:50:00 UTC

[jira] [Comment Edited] (CASSANDRA-17083) testsome target doesn't work with wildcards

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

Bernardo Botella Corbi edited comment on CASSANDRA-17083 at 5/5/22 11:49 PM:
-----------------------------------------------------------------------------

I don't think what we are trying to accomplish here is possible with current ant version. Right now, the ant JUnit task we are using provides two different attributes:
 * test -> it has a required field called name, and which represents the FQDN of the test class. It has an optional methods parameter that can be used to define a list of methods to be run. We are using this attribute in the [testsome target|https://github.com/apache/cassandra/blob/trunk/build.xml#L1658-L1668]. Name field does not support wildcards, and that is the reason the testsome target fails as described in the ticket.
 * batchtest -> it receives a series of filters that are used to determine which test classes will be run, and doesn't accept any concept of methods. We are using this attribute in the [test target|https://github.com/apache/cassandra/blob/trunk/build.xml#L1925-L1931], you'll see that if you follow the macros definitions. Those filters support wildcards, and that is the reason the test target works as described in the ticket.

Full documentation of these two attributes can be found [here|https://ant.apache.org/manual/Tasks/junit.html].

Now, as I understand this ticket, we would need to be able to filter by two different dimensions on the batchtest approach (the goal is to perform several test), class name AND methods. As we have just seen, this is not supported at this point as batchtest only supports class names.

Hence, in my opinion, the correct path forward would be:
 # [Create an enhancement report|https://issues.apache.org/bugzilla/enter_bug.cgi?product=Ant&bug_severity=enhancement] for Ant. This should mention the need to modify the [batchtest logic|https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java#L604-L609] in order to support filter by method names.
 # Work with Ant team members to have this implemented and released.
 # Update the version Cassandra is using to have support for this.

The alternative of extending the [JUnitTask class|https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java] in our own project to add support to that seems hardly maintainable on the long run, and I would definitely discourage it.


was (Author: JIRAUSER285406):
I don't think what we are trying to accomplish here is possible with current ant version. Right now, the ant JUnit task we are using provides two different attributes:
 * test -> it has a required field called name, which is required, and which represents the FQDN of the test class. It has an optional methods parameter that can be used to define a list of methods to be run. We are using this attribute in the [testsome target|https://github.com/apache/cassandra/blob/trunk/build.xml#L1658-L1668]. Name field does not support wildcards, and that is the reason the testsome target fails as described in the ticket.
 * batchtest -> it receives a series of filters that are used to determine which test classes will be run, and doesn't accept any concept of methods. We are using this attribute in the [test target|https://github.com/apache/cassandra/blob/trunk/build.xml#L1925-L1931], you'll see that if you follow the macros definitions. Those filters support wildcards, and that is the reason the test target works as described in the ticket.

Full documentation of these two attributes can be found [here|https://ant.apache.org/manual/Tasks/junit.html].

Now, as I understand this ticket, we would need to be able to filter by two different dimensions on the batchtest approach (the goal is to perform several test), class name AND methods. As we have just seen, this is not supported at this point as batchtest only supports class names.

Hence, in my opinion, the correct path forward would be:
 # [Create an enhancement report|https://issues.apache.org/bugzilla/enter_bug.cgi?product=Ant&bug_severity=enhancement] for Ant. This should mention the need to modify the [batchtest logic|https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java#L604-L609] in order to support filter by method names.
 # Work with Ant team members to have this implemented and released.
 # Update the version Cassandra is using to have support for this.

The alternative of extending the [JUnitTask class|https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java] in our own project to add support to that seems hardly maintainable on the long run, and I would definitely discourage it.

> testsome target doesn't work with wildcards
> -------------------------------------------
>
>                 Key: CASSANDRA-17083
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-17083
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Build
>            Reporter: Berenguer Blasi
>            Assignee: Bernardo Botella Corbi
>            Priority: Normal
>              Labels: low-hanging-fruit
>             Fix For: 3.11.x, 4.0.x, 4.x
>
>
> Running {{ant test -Dtest.name=PasswordObfuscator*Test}} runs the test correctly. But {{ant testsome -Dtest.name=PasswordObfuscator*Test}} will make it fail like
> {noformat}
> [junit-timeout] Testsuite: org.apache.cassandra.cql3.PasswordObfuscatorTest
> [junit-timeout] Testsuite: org.apache.cassandra.cql3.PasswordObfuscatorTest Tests run: 18, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.038 sec
> [junit-timeout] 
> [junit-timeout] Testsuite: PasswordObfuscator*Test
> [junit-timeout] Testsuite: PasswordObfuscator*Test Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0 sec
> [junit-timeout] 
> [junit-timeout] Null Test: 	Caused an ERROR
> [junit-timeout] PasswordObfuscator*Test
> [junit-timeout] java.lang.ClassNotFoundException: PasswordObfuscator*Test
> [junit-timeout] 	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
> [junit-timeout] 	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
> [junit-timeout] 	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
> [junit-timeout] 	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
> [junit-timeout] 	at java.lang.Class.forName0(Native Method)
> [junit-timeout] 	at java.lang.Class.forName(Class.java:348)
> [junit-timeout] 
> [junit-timeout] 
> [junit-timeout] Test PasswordObfuscator*Test FAILED
> {noformat}
> We should fix testsome as this is a useful feature for 'families' of tests such as {{ViewComplex*Test}}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org