Skip to content

[SUREFIRE-2148] Verify recovered BeforeAll does not fail build - #3419

Merged
olamy merged 1 commit into
apache:masterfrom
wilx:issue-2749-beforeall-rerun-success-it
Aug 9, 2026
Merged

olamy merged 1 commit into
apache:masterfrom
wilx:issue-2749-beforeall-rerun-success-it

Conversation

@wilx

@wilx wilx commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Following this checklist to help us incorporate your
contribution quickly and easily:

  • Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Run mvn clean install to make sure basic checks pass. A more thorough check will
    be performed on your pull request automatically.
  • You have run the integration tests successfully (mvn -Prun-its clean install).

If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

Summary

Fixes #2749.

The production behavior was corrected by #3200 and released in Surefire 3.5.5, but its integration test combines a recovered @BeforeAll failure with a class that always fails. Because that test expects the overall Maven invocation to fail, it does not protect the original SUREFIRE-2148 requirement: a build must succeed when the only setup failure passes on rerun.

This adds a focused JUnit Platform fixture whose @BeforeAll fails once and succeeds on the only retry. The integration test requires a successful Maven exit, verifies the lifecycle failure is reported as a flake followed by Run 2: PASS, and asserts the final report contains no errors or failures.

User impact

There is no production-code change. The existing fix is now covered against regressions that would incorrectly fail a build after a recovered @BeforeAll error.

Tests

  • nice -n 10 env JAVA_HOME=/opt/jdks/latest-17 /opt/maven/latest/bin/mvn clean install -Dmaven.build.cache.enabled=false (17 modules, build success)
  • nice -n 10 env JAVA_HOME=/opt/jdks/latest-17 /opt/maven/latest/bin/mvn -Prun-its clean install -Dmaven.build.cache.enabled=false (762 integration tests, 0 failures, 0 errors, 153 skipped)
  • exact standalone SUREFIRE-2148 reproducer against 3.6.0-M2-SNAPSHOT (first @BeforeAll run errors, retry passes, one flake, build success)

Add a focused JUnit Platform integration test where BeforeAll fails once and succeeds on the only retry. Assert the successful Maven exit and the resulting flaky report.

Fixes apache#2749
@wilx
wilx marked this pull request as ready for review August 9, 2026 00:18
@olamy olamy added this to the 3.6.0-M2 milestone Aug 9, 2026
@olamy
olamy merged commit 2f4ba64 into apache:master Aug 9, 2026
14 checks passed
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown

@olamy Please assign appropriate label to PR according to the type of change.

@wilx
wilx deleted the issue-2749-beforeall-rerun-success-it branch August 9, 2026 10:11
@slachiewicz slachiewicz added the enhancement New feature or request label Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SUREFIRE-2148] Build fails if retried test classes failed during setup

3 participants