[FLINK-39845][tests] Fix SavepointITCase.testStopWithSavepointFailsOverToSavepoint under AdaptiveScheduler#28352
Open
MartijnVisser wants to merge 1 commit into
Conversation
…erToSavepoint under AdaptiveScheduler The JUnit5 migration (FLINK-39124, apache#27667) replaced a cause-chain search (ExceptionUtils.assertThrowable -> findThrowable) with a direct-cause assertion (assertThatThrownBy(...).hasCauseInstanceOf(StopWithSavepointStoppingException.class)). Under the AdaptiveScheduler, StopWithSavepoint.onLeave() wraps the expected StopWithSavepointStoppingException inside a FlinkException ("Stop with savepoint operation could not be completed."), so it is no longer the direct cause. This regressed the test_cron_adaptive_scheduler nightly leg on master (red every build since 2026-03-21); the default scheduler still exposes it as the direct cause and passed. Restore the chain search via FlinkAssertions.anyCauseMatches so the test passes under both the default and adaptive schedulers, matching the pre-migration behavior still present on release-2.1. Generated-by: Claude Code (Claude Opus 4.8) (cherry picked from commit c3ec569)
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
Backport of #28311 (commit c3ec569) to
release-2.3.The JUnit5 migration (FLINK-39124, #27667 — also present on
release-2.3) replaced a cause-chain search inSavepointITCase.testStopWithSavepointFailsOverToSavepoint(ExceptionUtils.assertThrowable->findThrowable) with a direct-cause assertion (assertThatThrownBy(...).hasCauseInstanceOf(StopWithSavepointStoppingException.class)).Under the AdaptiveScheduler,
StopWithSavepoint.onLeave()wraps the expectedStopWithSavepointStoppingExceptioninside aFlinkException("Stop with savepoint operation could not be completed."), so it is no longer the direct cause. The default scheduler still exposes it directly, so the test passes there but fails under the adaptive scheduler.This restores the cause-chain search so the test passes under both schedulers.
Brief change log
testStopWithSavepointFailsOverToSavepointwithFlinkAssertions.anyCauseMatches(StopWithSavepointStoppingException.class, "A savepoint has been created at: "), which searches the whole cause chain (restoring the pre-migration semantics).(Note: the shared
anyCauseMatcheshelper matches the message withcontainsrather than the originalstartsWith. This is safe here because the phrase is the leading text ofStopWithSavepointStoppingException's own message, andanyCauseMatchesbinds the class and the message to the same throwable in the chain.)Verifying this change
This change is already covered by the existing
SavepointITCase.testStopWithSavepointFailsOverToSavepoint. The cherry-pick applied cleanly ontorelease-2.3(which carries the same #27667 migration commit), andFlinkAssertions.anyCauseMatches(Class, String)is present on the branch.Does this pull request potentially affect one of the following parts:
@Public(Evolving): noDocumentation
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Claude Opus 4.8)