[infra] Derive and validate the Flink versions tools/ut.sh uses - #1007
[infra] Derive and validate the Flink versions tools/ut.sh uses#1007weiqingy wants to merge 5 commits into
Conversation
… pom The help text said that omitting -f runs every supported Flink version. It runs one. DEFAULT_FLINK_VERSION was pinned to 2.2 while the root pom carried 2.3.0, so a bare tools/ut.sh tested Java on 2.3.0 and Python on 2.2.x in the same command. The default now derives from <flink.version> in the root pom, so both lanes land on the same version and a bump cannot leave this script behind. tools/update_flink_version.sh rewrites poms only, which is how the two drifted apart in the first place. A value that is not shaped x.y is fatal rather than flowing on into dist module paths, -P profile names and the pip requirement. This changes what the Python unit-test jobs install, from apache-flink~=2.2.0 to ~=2.3.0, in both ci.yml and build_wheel.yml. Measured on the derived default: 825 passed, 13 skipped against PyFlink 2.3.0. The integration matrices pass -e -f explicitly and are unaffected. The help text now states the derived default, and that -f applies to the e2e and Python tests rather than to the Java unit tests. Generated-by: Claude Code 2.1.229 (Claude Opus 5)
tools/ut.sh -j -f 1.20 accepted the flag and then tested exactly what it would have tested anyway. The Java unit-test invocations pass no -P and exclude the e2e modules, so an explicitly requested version never reaches them, and nothing said so. The warning fires only when a version was passed rather than defaulted, Java is selected, and -e is not. It names the Java unit tests rather than claiming the flag was ignored outright, because a default run also executes the Python tests, which do install against the requested version. A warning rather than a rejection: rejecting the flag would turn a working command into a failing one, and the same information fits in a warning. None of the workflow invocations trigger it. Both integration matrices pass -e alongside -f, and the single-version jobs pass no -f. Generated-by: Claude Code 2.1.229 (Claude Opus 5)
-f took any string. tools/ut.sh -j -e -f 9.9 asked Maven to build dist/flink-9.9, a module that does not exist, and to activate a profile of the same name. A typo looked like it worked. The supported set now comes from the dist/flink-* modules rather than a second hardcoded list, and both the explicit value and the derived default are checked against it, so the two derivations cannot drift apart. Each rejection names its own cause: a caller error, a root pom that has moved ahead of the dist modules, or no dist modules at all. -f 2.3 also selected a profile that did not exist. The e2e integration pom defined flink-1.20 through flink-2.2 while 2.3 was its unprofiled default, so Maven warned and carried on, landing on 2.3.0 by fallthrough. Adding the profile makes the flag mean something for every value now accepted. The new profile omits flink.log4j2.version. Its four siblings pin 2.24.3 because they need a value different from the parent's; 2.3 needs the parent's 2.25.3, and a redundant pin would stop tracking it. Verified behavior-neutral: flink.version, flink.agents.dist.artifactId and flink.log4j2.version all resolve identically with and without -Pflink-2.3. A test asserts the three lists that must agree still do: the dist/flink-* directories, dist/pom.xml's modules, and the e2e integration pom's flink-* profile ids. Their disagreement is what left 2.3 without a profile. Generated-by: Claude Code 2.1.229 (Claude Opus 5)
|
Thanks for the update. Deriving the default Flink version from the root POM looks good. One concern with the current CLI contract is that The current examples should also be updated: $0 -f 2.2 # Run tests only for Flink 2.2This is not accurate because Java UTs still use the root POM version. If |
-f reached the e2e path and the Python tests but never the Java unit tests, so one flag meant two things depending on what else was selected. The script warned about that half of the split rather than removing it. -f now selects the Flink version the e2e tests run against and nothing else, and passing it without -e is rejected. Both unit-test lanes are left where they already were: each Java module builds against the <flink.version> its own pom resolves, and the Python unit tests install the requirement built from the root pom's value. The rejection is checked before the version itself is validated, because a flag that does not apply makes the value it carries beside the point, and reporting that value as unsupported would send the caller looking for a different one. Nothing in the repository invokes -f without -e. Both matrix jobs pass -e -f explicitly, and the four single-version invocations pass no -f, so the capability this removes is running the Python unit tests against a non-default PyFlink, which no job, script or document uses. The help text carried three inaccurate examples, two of which predate this branch: an inline list and a $0 block that both demonstrated forms the script now rejects, and a missing-argument hint doing the same. All three are corrected, and a test asserts the script demonstrates no -f form it would itself reject, so a future example cannot reintroduce one. The rejection's wording is pinned clause by clause. An earlier revision of this branch claimed the unit tests run against the root pom version, which is false for Java: dist/flink-1.20 stays in the unit-test reactor and builds at 1.20.5. Rewriting any clause into something false now fails a test rather than passing silently. Generated-by: Claude Code 2.1.229 (Claude Opus 5)
|
@wenjin272 Thanks, that is a better contract. Done in 32a90b0.
Examples fixed. There were two more carrying the same problem that I had missed: the inline One correction on the wording while implementing it. "Both Java and Python UTs would then consistently use the root POM version" turns out not to hold for Java. The |
The cross-language job failed while Maven Central was returning 429 for the ASF parent pom, before any project was scanned. No source change; this commit only re-triggers the workflow. Generated-by: Claude Code 2.1.229 (Claude Opus 5)
Linked issue: #1006
Purpose of change
tools/ut.shsaid omitting-ftests every supported Flink version. It tests one. The default was pinned to2.2while the root pom carries2.3.0, so a bare run tested Java on 2.3.0 and Python on 2.2.x at once.-fwas half-wired on top of that: it reached the e2e and Python tests, but nothing on the Java unit-test path reads it.<flink.version>instead of pinning it, so both lanes agree and the value cannot drift again.tools/update_flink_version.shbumps poms and never touches this script, which is how the literal fell behind. Validated asx.ybefore use, since it flows into module paths, profile names and the pip requirement.-fto the e2e tests and reject it without-e. Unit tests stay where they were: each Java module on the<flink.version>its own pom resolves, Python on the root pom's. No caller in the repo passes-fwithout-e.-faccepts.-f 9.9used to ask Maven for a module that does not exist, so a typo looked like it worked. The supported set now comes from thedist/flink-*modules rather than a second hardcoded list. This also adds the missingflink-2.3e2e profile, which-f 2.3previously hit by fallthrough after Maven warned and ignored it. The profile omitsflink.log4j2.versionon purpose: its siblings pin2.24.3because they need a value different from the parent's, and 2.3 needs the parent's.Subsumes #1008.
The issue's other option, iterating every version by default, is not implementable today:
runtimefailstest-compileat 1.20 becauseRescalingTest.javaimports Flink 2.x-only packages. It would also multiply every Java unit-test job by roughly five, to duplicate what thejava_it_testsmatrix already covers.Tests
Three bats files, 25 cases, in the harness CI already runs. Subprocess and shim patterns from
help.batsanddry_run.bats; none sourcesut.sh, which has no run guard.They cover the derived default (that it follows a changed pom, and the malformed shapes that must be fatal), the
-frejection (its condition and each clause of its message, so a clause rewritten into something false fails), and version validation against a fakedist/. One case asserts the help text shows no-fform the script would reject. One guards the three lists that must agree, whose disagreement is what left 2.3 without a profile.Full harness 216 ok / 1 not ok. The failure is pre-existing and unrelated (
verify_example_job.batsviatest_submit_examples_to_flink.sh:362,remaining_pids[@]unbound); it reproduces on unmodifiedmain../tools/ut.sh -pon the new default: 825 passed, 13 skipped, exit 0, onapache-flink 2.3.0confirmed from the environment.One behavior change: the Python unit-test jobs in
ci.ymlandbuild_wheel.ymlnow installapache-flink~=2.3.0rather than~=2.2.0, the current PyPI latest. Both integration matrices pass-e -fexplicitly and are unaffected. Not covered: thepipfallback branch ofut.sh -p.API
No public API change. The observable change is to the script's CLI behavior and help text, described above.
Documentation
doc-neededdoc-not-neededdoc-includedEvery inaccurate claim was in the script's own help text, which this PR corrects. No file under
docs/referencestools/ut.sh.Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code 2.1.229 (Claude Opus 5)