Jan Høydahl created SOLR-18660:
----------------------------------

             Summary: beast task silently runs no tests since the Gradle 9 
upgrade
                 Key: SOLR-18660
                 URL: https://issues.apache.org/jira/browse/SOLR-18660
             Project: Solr
          Issue Type: Bug
          Components: Build
            Reporter: Jan Høydahl


🤖 {{gradlew beast}} completes successfully without running any test, and has 
done since the Gradle 9 upgrade.

{noformat}
$ ./gradlew -p solr/core beast -Ptests.dups=2 --tests 
"org.apache.solr.core.backup.BackupIdTest"
> Task :solr:core:test_1 NO-SOURCE
> Task :solr:core:test_2 NO-SOURCE
BUILD SUCCESSFUL in 9s
{noformat}

The same filter under the ordinary test task runs three tests, so neither the 
filter nor the class is at fault.

h2. Cause

{{gradle/testing/beasting.gradle}} creates each duplicate as a bare {{Test}} 
task and sets neither {{testClassesDirs}} nor {{classpath}}, relying on a 
Gradle convention that supplied them. Gradle deprecated that convention and 
removed it in 9.0:

{quote}Relying on the convention for Test.testClassesDirs in custom Test tasks 
has been deprecated. This is scheduled to be removed in Gradle 9.0.{quote}

(see {{upgrading_version_8.html#test_task_default_classpath}})

Reproduced against a minimal project with a single bare {{Test}} task: 
{{testClassesDirs}} resolves to 1 entry under Gradle 8.10 and 8.14, and to 0 
under 9.6.0, 9.7.0 and 9.8.0. An empty {{testClassesDirs}} makes the task 
{{NO\-SOURCE}}, so Gradle skips it \- and because it is skipped, the 
{{fail\-on\-no\-tests}} check never fires and the build reports success.

Broken by {{0d0a7ab6bf2}} "SOLR\-18289: Build: upgrade Gradle to 9.6.0 
(#4539)", 2026\-06\-26. The deprecation warning was emitted as far back as 
Gradle 8.10, but only under {{\-\-warning\-mode=all}}, and Solr went straight 
from 8.10 to 9.6.0 without running 8.11\-8.14.

h2. Scope

Only beast's generated {{test_N}} tasks are affected; they are the only custom 
{{Test}} tasks on main. Any new custom {{Test}} task must now set both 
properties explicitly.

h2. Fix

Set {{testClassesDirs}} and {{classpath}} from the project's test source set 
when creating each subtask, per the Gradle upgrade guide.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

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

Reply via email to