Skip to content

Fix test tasks that pass without running any tests - #13274

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
masterfrom
bbujon/ci-tests-not-running
Nov 12, 2026
Merged

gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
masterfrom
bbujon/ci-tests-not-running

Conversation

@PerfectSlayer

@PerfectSlayer PerfectSlayer commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

What Does This Do

Runs every Gradle Test task on the JUnit Platform and makes a test task fail when it discovers no tests. A misconfigured test task can no longer pass silently.

This brings back test tasks that had never run a test since their creation:

  • the four multi-Scala test tasks of scala-2.10.7 (34 tests each);
  • the testRuntimeActivation task of springboot-graphql. Its attack-detection feature is skipped for now, because nothing activates AppSec in that mode (APMLP-2199).

It also removes spring-tomcat7's testRuntimeActivation task, which was a copy of springboot's that only reran the test task.

Motivation

Since the Gradle 8.1 upgrade (April 2023), only test suites get the JUnit Platform. A task registered with tasks.register(..., Test) falls back to JUnit 4. It then discovers none of the Spock 2 or JUnit 5 tests and still passes. The Gradle 9.5.1 bump would have surfaced this, but it added failOnNoDiscoveredTests = false, which hid it. CI Visibility reports zero executions for these tasks on master.

Additional Notes

  • Where empty tasks are still allowed:
    • A non-forked task whose compiled test classes include *ForkedTest classes is allowed to be empty, because it only hosts abstract bases. The check reads the compiled classes at execution time.
    • Three modules whose test source set only holds shared abstract bases opt out explicitly.
    • Based on master CI data, no other test task discovers zero tests. Tag-filtered runs (-PrunFlakyTests) and --tests runs are exempt on Gradle's side.
  • testRuntimeActivation: only springboot's task was designed for runtime activation (2022). Since Upgrade libddwaf java to 14.0.0 #8654, AppSec only loads its rules on a real activation through remote config, so the app-side reflective activation no longer works. The other modules copied the task without any activation:
    • springboot-graphql keeps its task. Its detection feature is skipped in that mode until the AppSec team adds a real activation through remote config (APMLP-2199).
    • spring-tomcat7's spec is IAST-only and never applies the inactive-AppSec flag, so its task reran test unchanged. It is removed.
    • The two smoke apps without any tests are tracked in APMLP-2206 (springboot-security) and APMLP-2205 (kafkaschemaregistry).
  • Known edge: a task whose only tests are @Flaky JUnit tests would now fail under -PskipFlakyTests, since FlakyJUnitFilter removes them during discovery. No task is in that situation today.

Jira ticket: APMLP-2186

🤖 Generated with Claude Code

@PerfectSlayer PerfectSlayer added type: bug fix Bug fix comp: testing Testing tag: no release notes Changes to exclude from release notes tag: ai generated Largely based on code generated by an AI or LLM labels Nov 6, 2026
@datadog-prod-us1-6

datadog-prod-us1-6 Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

🎯 Code Coverage (details)
• Patch Coverage: 100.00%
• Overall Coverage: 59.76% (+0.00%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 806a52c | Docs | Give us feedback!

@dd-octo-sts

dd-octo-sts Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 14.83 s 14.60 s [+0.7%; +2.4%] (maybe worse)
startup:insecure-bank:tracing:Agent 13.67 s 13.68 s [-0.8%; +0.6%] (no difference)
startup:petclinic:appsec:Agent 17.24 s 17.10 s [-0.1%; +1.8%] (no difference)
startup:petclinic:iast:Agent 17.08 s 17.22 s [-1.5%; -0.0%] (maybe better)
startup:petclinic:profiling:Agent 16.89 s 16.82 s [-0.6%; +1.5%] (no difference)
startup:petclinic:sca:Agent 17.24 s 16.97 s [+0.7%; +2.5%] (maybe worse)
startup:petclinic:tracing:Agent 16.30 s 16.28 s [-0.7%; +0.9%] (no difference)

Commit: 806a52c3 · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

@PerfectSlayer
PerfectSlayer marked this pull request as ready for review November 6, 2026 09:34
@PerfectSlayer
PerfectSlayer requested review from a team as code owners November 6, 2026 09:34
@PerfectSlayer
PerfectSlayer requested review from dougqh, jandro996 and manuel-alvarez-alvarez and removed request for a team November 6, 2026 09:34
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T09:37:44.197996Z a109a8d Draft marked ready
🔒 Security Review ✅ Completed 2026-11-06T09:36:44.478647Z a109a8d Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@PerfectSlayer
PerfectSlayer force-pushed the bbujon/ci-tests-not-running branch from a109a8d to d75ed4f Compare November 6, 2026 09:43

@datadog-prod-us1-6 datadog-prod-us1-6 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: PASS

More details

The empty-task exceptions are consistent with the repository’s forked-test and abstract-base conventions. Whether the revived tasks execute successfully remains unverified because Gradle tests were not run.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit a109a8d

@jandro996 jandro996 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that the testRuntimeActivation tasks of springboot-security and datastreams/kafkaschemaregistry still run nothing after this change. Neither module has a src/test source set, so Gradle skips both tasks as NO-SOURCE (@SkipWhenEmpty on the candidate class files) before failOnNoDiscoveredTests is ever evaluated, and they keep passing silently. The description lists them among the revived tasks, and APMLP-2186 has "the two smoke apps without tests either get tests or are removed" in its done criteria. APMLP-2199 covers springboot-security (item 4), but I could not find anything tracking kafkaschemaregistry, whose task does not even set an AppSec mode and looks like a copy of the regular test task. Would it make sense to drop those two tasks here, or at least adjust the description and track kafkaschemaregistry in a follow-up? I might be missing something, what do you think?

@jandro996 jandro996 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Just left some comments to track with APMLP-2199

@PerfectSlayer

PerfectSlayer commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator Author

but I could not find anything tracking kafkaschemaregistry,

I'm currently investigating if it can be dropped or not (as covered by instrumentation tests).
But the AppSec part of this smoke test is clearly a copy/paste errror.
So far, I'll drop it if covered somewhere else as, right now, it leaves the false sense of coverage while nothing is run.

@dougqh dougqh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, nice to have this enforced globally instead of per task. One coordination note with #13333 (Test AppSec runtime activation through remote config in smoke tests): that PR makes testRuntimeActivation actually activate AppSec through RC, so whichever of the two lands second should drop the @IgnoreIf on 'test detect #description'. Otherwise it stays skipped once activation works. Both also touch the testRuntimeActivation block in springboot/build.gradle, so expect a small conflict there.

PerfectSlayer and others added 2 commits November 12, 2026 12:26
Run every Test task on the JUnit Platform, not only test suites: tasks
registered with tasks.register(..., Test) fell back to JUnit 4 since the
Gradle 8.1 upgrade and discovered none of the Spock 2 or JUnit 5 tests.

Fail a test task that discovers no tests again, except for the non-forked
peer of a suite whose concrete tests are all *ForkedTest classes, and for
three test source sets that only hold shared abstract bases.

Skip the springboot-graphql detection feature in testRuntimeActivation,
which loads AppSec without ever activating it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AppSec is now activated through remote config in testRuntimeActivation,
so the GraphQL detection feature no longer needs to be skipped in that
mode. Also drop the task's useJUnitPlatform(), which the test convention
now applies to every Test task.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@PerfectSlayer
PerfectSlayer force-pushed the bbujon/ci-tests-not-running branch from c6071d7 to 806a52c Compare November 12, 2026 11:48

@datadog-prod-us1-6 datadog-prod-us1-6 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: PASS

More details

The shared JUnit Platform configuration covers manually registered test tasks, and the explicit empty-task exemptions match their abstract-base test sources. Gradle execution behavior remains unverified.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 806a52c

@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit 774130f into master Nov 12, 2026
685 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the bbujon/ci-tests-not-running branch November 12, 2026 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: testing Testing tag: ai generated Largely based on code generated by an AI or LLM tag: no release notes Changes to exclude from release notes type: bug fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants