Skip to content

docs: clarify Maven test invocation for ScalaTest suites#4238

Open
andygrove wants to merge 4 commits intoapache:mainfrom
andygrove:docs/maven-test-pitfalls
Open

docs: clarify Maven test invocation for ScalaTest suites#4238
andygrove wants to merge 4 commits intoapache:mainfrom
andygrove:docs/maven-test-pitfalls

Conversation

@andygrove
Copy link
Copy Markdown
Member

Which issue does this PR close?

Closes #.

Rationale for this change

The contributor guide's "Common Build and Test Pitfalls" section currently recommends
-DwildcardSuites=... for running specific tests. In practice this leads to two
recurring foot-guns:

  1. The recommendation conflicts with the working invocation shown later in the same
    document (-Dsuites= with -Dtest=none), so contributors copy the wrong pattern.
  2. A common variant, ./mvnw test -Dsuites="..." -DwildcardSuites="", silently runs
    every suite in the project (the empty string is a substring of every suite name)
    and takes around an hour, instead of running the named suite.

The existing warning about -pl spark also understates the problem: -pl resolves
sibling modules from ~/.m2/repository, which not only causes stale-code surprises
but cross-contaminates concurrent worktrees that share the same local Maven repo.

What changes are included in this PR?

Edits to docs/source/contributor-guide/development.md:

  • Renamed and expanded the -pl pitfall to call out both stale-code and
    cross-worktree corruption under concurrent builds.
  • Replaced the misleading "Use wildcardSuites" subsection with a "Running a
    Specific ScalaTest Suite" subsection that documents the correct minimal
    invocation, explains why -Dtest=none is required, and adds an explicit
    callout for the -DwildcardSuites="" pitfall.
  • Cross-linked the later "Running Tests from command line" section to the new
    pitfall callout so the two places stay in sync.

How are these changes tested?

Documentation-only change, no test changes required.

andygrove added 3 commits May 6, 2026 07:01
Strengthen the existing pitfall on `-pl spark` by explaining both
failure modes: stale `~/.m2` resolution and cross-worktree corruption
under concurrent builds.

Replace the prior `-DwildcardSuites=...` recommendation with the
correct single-suite invocation (`-Dsuites=` plus `-Dtest=none`) and
call out the `-DwildcardSuites=""` pitfall, where an empty pattern
silently expands to "match every suite" and overrides `-Dsuites=`.
Add a pitfall callout explaining that a bare newline ends a shell
command, so copy-pasting a multi-line `./mvnw test -Dtest=none ...`
without trailing backslashes silently runs only `./mvnw test
-Dtest=none` (which runs every ScalaTest suite in the module). Show
the same command on one line and with explicit line continuations.
Scalastyle runs on every `mvn test` invocation and rescans the whole
module. Document the skip flag for local iteration; CI still enforces
the check.
@andygrove andygrove marked this pull request as ready for review May 6, 2026 13:10
@mbutrovich
Copy link
Copy Markdown
Contributor

Can we add the pitfall that if you get the suite matching/test wildcards wrong, maven will still happily run and probably give you an exit code 0 (which is what most agents cue off of), so you should double check that the tests you want actually ran?

@andygrove
Copy link
Copy Markdown
Member Author

Can we add the pitfall that if you get the suite matching/test wildcards wrong, maven will still happily run and probably give you an exit code 0 (which is what most agents cue off of), so you should double check that the tests you want actually ran?

Added

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