Skip to content

Remove dead surefire executions in root pom#17696

Open
JackieTien97 wants to merge 1 commit into
apache:masterfrom
JackieTien97:remove-dead-surefire-executions
Open

Remove dead surefire executions in root pom#17696
JackieTien97 wants to merge 1 commit into
apache:masterfrom
JackieTien97:remove-dead-surefire-executions

Conversation

@JackieTien97
Copy link
Copy Markdown
Contributor

Summary

Removes two surefire <execution> blocks from the root pom.xml that never actually run any tests, but silently cause triple test-execution if anyone passes a CLI flag like -Dsurefire.includesFile= or -Dtest=. The TODO comment above the plugin already acknowledged they should be removed.

What the dead executions look like

<plugin>
  <artifactId>maven-surefire-plugin</artifactId>
  <executions>
    <execution>
      <id>unit-tests</id>
      <phase>test</phase>
      <configuration>
        <includes><include>src/test/**/*Test.java</include></includes>
        <excludes><exclude>src/test/**/*IT.java</exclude></excludes>
      </configuration>
    </execution>
    <execution>
      <id>integration-tests</id>
      ...
    </execution>
  </executions>
</plugin>

Why they are dead

Surefire scans ${project.build.testOutputDirectory} — i.e. target/test-classes/ — and matches <includes> against paths relative to that directory. Those paths look like org/apache/iotdb/.../FooTest.class, never prefixed by src/test/. So the patterns above match zero test classes on every build.

Evidence from the latest master Unit-Test run (job 76358113571, Windows datanode):

Plugin execution Duration Tests run
surefire:test (default-test) 49 min 3629
surefire:test (unit-tests) ~1 sec 0
failsafe:integration-test (run-integration-tests) ~4 sec 1 (EnvScriptIT)
surefire:test (integration-tests) ~200 ms 0

Why they're worth removing even though master speed doesn't change

If someone tries to optimize CI by sharding via -Dsurefire.includesFile=... or selecting tests with -Dtest=..., the CLI flag replaces the broken <includes> with a valid pattern. Suddenly all three surefire executions (default-test, unit-tests, integration-tests) run the selected tests — the test list executes 3×. This trap was discovered while attempting #17693 (closed).

Regression check

  • Modules with *IT.java: only iotdb-core/datanode/ and integration-test/. Both already configure maven-failsafe-plugin explicitly, so IT coverage is unaffected.
  • Module-level overrides: no other pom redeclares an execution with id unit-tests or integration-tests.
  • CI flag usage: no workflow on master currently passes a surefire test-selector flag.
  • Profiles: the with-code-coverage profile only overrides the surefire/failsafe <argLine>; it does not depend on these executions' presence.

Test plan

  • Confirm the full Unit-Test workflow still runs the same number of tests (default-test reports Tests run: 3629 on master Windows datanode).
  • Confirm IT workflows (Cluster IT - 1C1D, Table Cluster IT - 1C1D, etc.) are unaffected.
  • Confirm coverage report (with-code-coverage profile) still produces output.

The root pom declared two extra surefire executions, `unit-tests` (bound to
the `test` phase) and `integration-tests` (bound to the `integration-test`
phase), each with an `<includes>` pattern prefixed by `src/test/`:

    <includes><include>src/test/**/*Test.java</include></includes>

Surefire scans `${project.build.testOutputDirectory}` (target/test-classes/)
for compiled tests and matches `<includes>` against paths relative to that
directory. Those paths never start with `src/test/`, so both executions match
zero tests on every build — verified against the latest master Unit-Test run
(job 76358113571): each completes in <1 second with no test output.

The TODO comment above the plugin already noted that integration tests should
move to the failsafe plugin. That's now the case: both modules containing
`*IT.java` (`iotdb-core/datanode/` and `integration-test/`) have explicit
`maven-failsafe-plugin` configurations driving their ITs. Removing these two
dead executions therefore changes nothing observable on master — same set of
tests, same wall clock — and eliminates a hidden trap: anyone passing a
surefire CLI flag like `-Dsurefire.includesFile=` or `-Dtest=` would
otherwise discover that the broken `<includes>` gets replaced by their valid
selector, accidentally activating the previously-dormant executions and
running the chosen tests three times instead of once.

Regression checked:
  - Only `iotdb-core/datanode/pom.xml` and `integration-test/pom.xml` contain
    `*IT.java`; both configure failsafe directly.
  - No other module-level pom redeclares an execution with id `unit-tests`
    or `integration-tests`.
  - No CI workflow passes a surefire test-selector flag that would have
    been affected.
  - The `with-code-coverage` profile only overrides the `<argLine>` for
    surefire/failsafe; it does not depend on these executions.
Copy link
Copy Markdown
Contributor

@HTHou HTHou left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants