alpinegizmo opened a new pull request, #28739:
URL: https://github.com/apache/flink/pull/28739
## What is the purpose of the change
The migration test snapshot generator instantiates test classes reflectively
and
previously only drove JUnit 4 @ClassRule/@Rule resources. After the JUnit 5
migration (FLINK-39124), the flink-tests migration tests rely on
@RegisterExtension
extensions and @BeforeEach methods instead, which the generator never ran.
This
broke snapshot generation for flink-tests:
* operator-restore tests failed with a NullPointerException in the
constructor,
because the TestExecutorExtension backing an instance field was never
started;
* StatefulJob*MigrationITCase were silently skipped, because their
generator
method became private and was not discovered via Class#getMethods().
## Brief change log
Add JUnit5TestEnvironment to drive the subset of the JUnit 5 lifecycle these
tests
rely on: @RegisterExtension extensions (beforeAll before instance
construction,
beforeEach/afterEach/afterAll), ParameterResolver for @InjectClusterClient,
@BeforeEach/@AfterEach methods and @TempDir fields, via a minimal
ExtensionContext/Store/ParameterContext. @ExtendWith runner-only extensions
are
intentionally not driven.
In SnapshotGeneratorUtils, discover non-public generator and parameters
methods
across the class hierarchy (Class#getMethods()/getMethod() only see public
ones),
and wrap each generator invocation in its own instance lifecycle so
parameterized
tests get a fresh MiniCluster per spec (sharing one cluster across specs
causes
"Did not see the expected accumulator results within time limit"). Pure
JUnit 4
migration tests are unaffected.
Also add junit-jupiter at compile scope, since the generator is a main
artifact
that now needs the JUnit 5 API, and remove leftover debug output.
## Verifying this change
This change is already covered by the existing snapshot migration tests.
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): yes (junit-jupiter
added at compile scope)
- The public API, i.e., is any changed class annotated with
`@Public(Evolving)`: no
- The serializers: no
- The runtime per-record code paths (performance sensitive): no
- Anything that affects deployment or recovery: JobManager (and its
components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
- The S3 file system connector: no
## Documentation
- Does this pull request introduce a new feature? no
- If yes, how is the feature documented? n/a
---
##### Was generative AI tooling used to co-author this PR?
- [ X] Yes (please specify the tool below)
Generated-by: Claude Opus 4.8 (1M context)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]