Skip to content

test(flink): improve streamer config and schema provider coverage - #19392

Merged
danny0405 merged 4 commits into
apache:masterfrom
danny0405:conf-converage
Jul 29, 2026
Merged

test(flink): improve streamer config and schema provider coverage#19392
danny0405 merged 4 commits into
apache:masterfrom
danny0405:conf-converage

Conversation

@danny0405

@danny0405 danny0405 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Describe the issue this Pull Request addresses

Several unit-testable configuration, streamer wiring, option resolution, and schema provider classes in hudi-flink had low or no line coverage. This left option parsing and validation, derived configuration, schema loading, and schema registry behavior largely unverified outside integration tests.

Summary and Changelog

  • Add representative JCommander parsing and derived-configuration assertions for the Flink streamer, clustering, and compaction configuration classes.
  • Preserve --hoodie-conf overrides when no --props file is supplied, and convert the documented retry interval from seconds to milliseconds in the derived Flink configuration.
  • Exercise the Flink streamer entry-point wiring with mocked pipelines and execution environment while leaving the run loop to integration coverage.
  • Expand option inference and resolution tests across task derivation, table modes, write operations, conflict strategies, partitioners, and buffer settings.
  • Add file-based schema provider tests for source, target, fallback, and failure behavior.
  • Add schema registry provider tests with mocked HTTP responses and authorization verification.

Codecov line coverage before and after from the common-and-other-modules
Flink unit-test upload on head fad501fc66fe:

Class Before After
FlinkStreamerConfig 0% 100.00%
FlinkClusteringConfig 0% 96.70%
FlinkCompactionConfig 66% 96.00%
HoodieFlinkStreamer 0% 87.23%
OptionsInference 13% 95.34%
OptionsResolver 74% 90.65%
SchemaRegistryProvider 0% 93.18%
FilebasedSchemaProvider 20% 88.57%

No code was copied.

Impact

No public API, configuration default, or performance impact. Runtime configuration now preserves --hoodie-conf overrides without requiring --props, and interprets --instant-retry-interval in the documented seconds before populating the millisecond Flink option. The remaining changes improve the Flink unit-test Codecov upload.

Risk Level

low. The two runtime changes align behavior with the existing CLI contract and are covered by focused configuration tests plus the full hudi-flink unit suite.

Documentation Update

none

Contributor's checklist

  • Read through contributor's guide
  • Enough context is provided in the sections above
  • Adequate tests were added if applicable

Testing

  • Focused coverage run: 47 tests, 0 failures, 0 errors.
  • Full hudi-flink unit suite: 1,384 tests, 0 failures, 0 errors, 1 skipped.
  • Rebased Hive driver-pool regression: 1 test, 0 failures, 0 errors.
  • Maven checkstyle: 0 violations.

@hudi-agent hudi-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ 🤖 This review was generated by an AI agent and may contain mistakes. Please verify any suggestions before applying.

Thanks for working on this! This PR adds unit-test coverage for several previously under-tested hudi-flink classes — streamer/clustering/compaction config parsing, OptionsInference/OptionsResolver resolution paths, and the file-based and schema-registry providers. I traced the non-obvious assertions (runtime-config version gating, scheduler-type resolution, and the write-buffer sizing math) against the production code and they correctly encode current behavior. No correctness issues found. A few style/readability suggestions in the inline comments. Please take a look, and this should be ready for a Hudi committer or PMC member to take it from here.
. A few nits on test method names and a confusing unused mock variable below.

cc @yihua

@codecov-commenter

codecov-commenter commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.88889% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 75.08%. Comparing base (a284d6e) to head (fad501f).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
...c/main/java/org/apache/hudi/util/StreamerUtil.java 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #19392      +/-   ##
============================================
+ Coverage     74.83%   75.08%   +0.25%     
- Complexity    32332    32377      +45     
============================================
  Files          2574     2574              
  Lines        142978   142985       +7     
  Branches      17527    17528       +1     
============================================
+ Hits         106992   107366     +374     
+ Misses        27921    27548     -373     
- Partials       8065     8071       +6     
Components Coverage Δ
hudi-common 82.22% <ø> (-0.03%) ⬇️
hudi-client 81.79% <ø> (ø)
hudi-flink 80.65% <88.88%> (+2.01%) ⬆️
hudi-spark-datasource 68.34% <ø> (+<0.01%) ⬆️
hudi-utilities 71.18% <ø> (ø)
hudi-cli 15.32% <ø> (ø)
hudi-hadoop 63.49% <ø> (ø)
hudi-sync 70.67% <ø> (ø)
hudi-io 79.57% <ø> (ø)
hudi-timeline-service 83.44% <ø> (-0.79%) ⬇️
hudi-cloud 64.00% <ø> (ø)
hudi-kafka-connect 53.42% <ø> (+0.21%) ⬆️
Flag Coverage Δ
common-and-other-modules 48.16% <88.88%> (+0.38%) ⬆️
flink-integration-tests 48.07% <88.88%> (+0.43%) ⬆️
hadoop-mr-java-client 43.39% <ø> (-0.01%) ⬇️
integration-tests 13.63% <0.00%> (-0.01%) ⬇️
spark-client-hadoop-common 48.70% <ø> (-0.01%) ⬇️
spark-java-tests 51.37% <ø> (-0.02%) ⬇️
spark-scala-tests 46.09% <ø> (+<0.01%) ⬆️
utilities 36.65% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
.../org/apache/hudi/streamer/FlinkStreamerConfig.java 100.00% <100.00%> (+100.00%) ⬆️
...c/main/java/org/apache/hudi/util/StreamerUtil.java 72.49% <85.71%> (+2.51%) ⬆️

... and 18 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions Bot added the size:L PR with lines of changes in (300, 1000] label Jul 28, 2026

@cshuo cshuo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few test coverage issues to consider.

@hudi-agent hudi-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ 🤖 This review was generated by an AI agent and may contain mistakes. Please verify any suggestions before applying.

Thanks for working on this! This PR mostly adds unit-test coverage for the Flink streamer/clustering/compaction config classes and schema providers, and it carries two small production fixes: converting --instant-retry-interval from seconds to milliseconds, and having StreamerUtil.getProps honor --hoodie-conf when no --props file is given. Both production changes look like genuine bug fixes, though they do alter runtime behavior despite the "no runtime impact" note — one worth double-checking is flagged inline. Please take a look at any inline comments, and this should be ready for a Hudi committer or PMC member to take it from here. A couple of vague test method names worth tightening up.

@hudi-bot

Copy link
Copy Markdown
Collaborator

CI report:

Bot commands @hudi-bot supports the following commands:
  • @hudi-bot run azure re-run the last Azure build

@github-actions github-actions Bot added size:XL PR with lines of changes > 1000 and removed size:L PR with lines of changes in (300, 1000] labels Jul 29, 2026

@cshuo cshuo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@voonhous voonhous left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@danny0405
danny0405 merged commit ed7327b into apache:master Jul 29, 2026
74 of 75 checks passed
return new TypedProperties();
TypedProperties properties = new TypedProperties();
cfg.configs.forEach(x -> {
String[] kv = x.split("=");

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Split --hoodie-conf only on the first =. String.split("=") rejects valid values that contain another = (for example a URL/query string or JSON expression), and because Java drops trailing empty fields it also rejects an intentionally empty value such as hoodie.datasource.write.partitionpath.field=. The --props path parses both cases successfully, so the behavior now depends on whether a props file was supplied. Please use split("=", 2) (and add coverage for embedded/empty values) so the no-file path preserves the complete value.

voonhous pushed a commit that referenced this pull request Aug 6, 2026
…9392)

Adapted for release-1.2.1: TestOptionsResolver#testConcurrencyControlModes
keeps only the NON_BLOCKING_CONCURRENCY_CONTROL assertion. The
OPTIMISTIC_CONCURRENCY_CONTROL half calls
OptionsResolver#isOptimisticConcurrencyControl, which this branch does not
have; master re-added that method in 348e7f1 (#18946, "feat(flink): Add
validation to reject multiple writers for flink RLI writes"), which is not
backported. A comment in the test records the omission.

The conflict also offered a HoodieTableConfig import that #19392 does not add
and nothing here uses, so it was left out to avoid an unused import.

Everything else applies unchanged, including both production changes: the
instantRetryInterval seconds-to-millis conversion in FlinkStreamerConfig and
the --config key=value parsing in StreamerUtil.

(cherry picked from commit ed7327b)
voonhous pushed a commit that referenced this pull request Aug 7, 2026
…9392)

Adapted for release-1.2.1: TestOptionsResolver#testConcurrencyControlModes
keeps only the NON_BLOCKING_CONCURRENCY_CONTROL assertion. The
OPTIMISTIC_CONCURRENCY_CONTROL half calls
OptionsResolver#isOptimisticConcurrencyControl, which this branch does not
have; master re-added that method in 348e7f1 (#18946, "feat(flink): Add
validation to reject multiple writers for flink RLI writes"), which is not
backported. A comment in the test records the omission.

The conflict also offered a HoodieTableConfig import that #19392 does not add
and nothing here uses, so it was left out to avoid an unused import.

Everything else applies unchanged, including both production changes: the
instantRetryInterval seconds-to-millis conversion in FlinkStreamerConfig and
the --config key=value parsing in StreamerUtil.

(cherry picked from commit ed7327b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL PR with lines of changes > 1000

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants