Skip to content

test(config): add unit test coverage for ConfigParserUtil#5659

Merged
Yicong-Huang merged 2 commits into
apache:mainfrom
aglinxinyuan:test-config-parser-util
Jun 13, 2026
Merged

test(config): add unit test coverage for ConfigParserUtil#5659
Yicong-Huang merged 2 commits into
apache:mainfrom
aglinxinyuan:test-config-parser-util

Conversation

@aglinxinyuan

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Pin behavior of ConfigParserUtil.parseSizeStringToBytes — the size-string parser used by StorageConfig for S3 multipart sizing. The common/config module had no test infrastructure before this PR (no src/test directory existed); this PR adds the directory and configures the standard ScalaTest dependency the way the other backend modules do.

Spec Source class Tests
ConfigParserUtilSpec ConfigParserUtil 16

Spec file name follows the <srcClassName>Spec.scala one-to-one convention.

Behavior pinned

Surface Contract
1KB / 1MB / 1GB parses to 1024L / 1024 * 1024L / 1024 * 1024 * 1024L
Multi-digit values (100MB, 1024KB, 128GB) scales correctly by the unit multiplier
5GB preserves Long precision (result exceeds Int.MaxValue)
0010KB parses to 10 * 1024L (decimal-only, no octal interpretation)
Missing unit (100) throws IllegalArgumentException with diagnostic
Unsupported unit (5TB) throws IllegalArgumentException
Empty string throws IllegalArgumentException
Lowercase unit (5mb) throws IllegalArgumentException (regex is anchored to [KMG]B)
Embedded whitespace (5 MB) throws IllegalArgumentException
Non-numeric value (abcMB) throws IllegalArgumentException
Unit-only input (MB) throws IllegalArgumentException
Return type Long (compile-time enforced)

Build-config change

Adds org.scalatest %% scalatest % 3.2.15 % Test to common/config/build.sbt. The version matches the other backend modules (common/workflow-operator, common/dao, amber). Scope is Test so the dependency does not leak into the production classpath.

Any related issues, documentation, discussions?

Closes #5655.

How was this PR tested?

Pure unit-test addition (plus the build-config tweak above); verified locally with:

  • sbt "Config/testOnly org.apache.texera.amber.util.ConfigParserUtilSpec" — 16 tests, all green
  • sbt scalafmtCheckAll — clean
  • CI to confirm

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 4.7 [1M context])

Pins behavior of the size-string parser used by StorageConfig for
S3 multipart sizing:
  - unit multipliers (KB / MB / GB), multi-digit values, Long-precision
    GB results that overflow Int
  - decimal interpretation of leading zeros (no octal)
  - IllegalArgumentException for missing unit, unsupported unit (TB),
    empty string, lowercase unit, embedded whitespace, non-numeric
    value, unit-only input

Adds scalatest as a Test dependency in common/config/build.sbt — the
module had no test infrastructure before this PR (no src/test
directory existed); scalatest is configured with `% Test` so it
doesn't leak into the production classpath. Version 3.2.15 matches
the other backend modules (common/workflow-operator, common/dao,
amber/build.sbt).

Closes apache#5655
Copilot AI review requested due to automatic review settings June 12, 2026 23:55
@github-actions github-actions Bot added dependencies Pull requests that update a dependency file common labels Jun 12, 2026

Copilot AI 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.

Pull request overview

Adds ScalaTest-based unit coverage to the common/config module to pin and protect the parsing contract of ConfigParserUtil.parseSizeStringToBytes, which is used by StorageConfig for S3 multipart part sizing.

Changes:

  • Introduces ConfigParserUtilSpec with targeted cases for valid units, multi-digit inputs, leading zeros, and malformed inputs.
  • Adds ScalaTest (org.scalatest % Test) to common/config’s build.sbt and creates the module’s initial src/test layout.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
common/config/src/test/scala/org/apache/texera/amber/util/ConfigParserUtilSpec.scala New ScalaTest spec covering parseSizeStringToBytes success and failure behaviors.
common/config/build.sbt Adds ScalaTest test-scope dependency to enable unit testing in common/config.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov-commenter

codecov-commenter commented Jun 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.55%. Comparing base (73c76f5) to head (2d27680).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5659      +/-   ##
============================================
- Coverage     52.96%   52.55%   -0.42%     
- Complexity     2522     2543      +21     
============================================
  Files          1075     1089      +14     
  Lines         41743    42131     +388     
  Branches       4513     4529      +16     
============================================
+ Hits          22109    22140      +31     
- Misses        18329    18678     +349     
- Partials       1305     1313       +8     
Flag Coverage Δ *Carryforward flag
access-control-service 71.42% <ø> (ø)
agent-service 34.36% <ø> (ø)
amber 52.67% <ø> (-1.09%) ⬇️
computing-unit-managing-service 1.65% <ø> (ø)
config-service 56.71% <ø> (ø)
file-service 57.06% <ø> (ø)
frontend 47.38% <ø> (ø)
pyamber 90.72% <ø> (ø)
python 90.74% <ø> (ø) Carriedforward from 3d07e37
workflow-compiling-service 58.69% <ø> (ø)

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

✅ No material benchmark regressions detected

🟢 15 better · 🔴 0 worse · ⚪ 0 noise (<±5%) · 0 without baseline

CI benchmark results are noisy; treat <±5% as noise unless repeated.

Dashboard · Run

config throughput MB/s latency max Δ latest / 7d
🟢 bs=10 sw=10 sl=64 437 0.267 22,512/32,867/32,867 us 🟢 -14.3% / 🟢 +9.3%
🟢 bs=100 sw=10 sl=64 935 0.571 104,940/133,211/133,211 us 🟢 +28.3% / 🟢 -8.6%
🟢 bs=1000 sw=10 sl=64 1,122 0.685 904,233/944,906/944,906 us 🟢 +18.6% / 🟢 +11.2%
Baseline details

Latest main 7ae9b35 from 2026-06-13T00:44:28.840Z

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 437 tuples/sec 394.18 tuples/sec 400.34 tuples/sec +10.9% +9.2%
bs=10 sw=10 sl=64 MB/s 0.267 MB/s 0.241 MB/s 0.244 MB/s +11.0% +9.3%
bs=10 sw=10 sl=64 p50 22,512 us 24,805 us 24,191 us -9.2% -6.9%
bs=10 sw=10 sl=64 p95 32,867 us 38,345 us 36,018 us -14.3% -8.7%
bs=10 sw=10 sl=64 p99 32,867 us 38,345 us 36,018 us -14.3% -8.7%
bs=100 sw=10 sl=64 throughput 935 tuples/sec 729.17 tuples/sec 867.19 tuples/sec +28.2% +7.8%
bs=100 sw=10 sl=64 MB/s 0.571 MB/s 0.445 MB/s 0.529 MB/s +28.3% +7.9%
bs=100 sw=10 sl=64 p50 104,940 us 133,219 us 114,874 us -21.2% -8.6%
bs=100 sw=10 sl=64 p95 133,211 us 173,178 us 142,264 us -23.1% -6.4%
bs=100 sw=10 sl=64 p99 133,211 us 173,178 us 142,264 us -23.1% -6.4%
bs=1000 sw=10 sl=64 throughput 1,122 tuples/sec 946.3 tuples/sec 1,010 tuples/sec +18.6% +11.1%
bs=1000 sw=10 sl=64 MB/s 0.685 MB/s 0.578 MB/s 0.616 MB/s +18.6% +11.2%
bs=1000 sw=10 sl=64 p50 904,233 us 1,059,718 us 995,071 us -14.7% -9.1%
bs=1000 sw=10 sl=64 p95 944,906 us 1,104,221 us 1,046,228 us -14.4% -9.7%
bs=1000 sw=10 sl=64 p99 944,906 us 1,104,221 us 1,046,228 us -14.4% -9.7%
Raw CSV
config_idx,batch_size,schema_width,string_len,num_batches,total_ms,total_tuples,total_bytes,tuples_per_sec,mb_per_sec,lat_p50_us,lat_p95_us,lat_p99_us
0,10,10,64,20,457.92,200,128000,437,0.267,22511.76,32866.85,32866.85
1,100,10,64,20,2138.07,2000,1280000,935,0.571,104939.84,133210.53,133210.53
2,1000,10,64,20,17824.58,20000,12800000,1122,0.685,904232.84,944905.53,944905.53

Comment thread common/config/build.sbt
common/config had no tests until this PR, so the amber job's jacoco
invocation explicitly skipped it. Add Config/jacoco so
ConfigParserUtilSpec actually runs in CI and the module's jacoco.xml /
test-reports are picked up by the existing Codecov upload globs.
@github-actions github-actions Bot added the ci changes related to CI label Jun 13, 2026
@Yicong-Huang Yicong-Huang added this pull request to the merge queue Jun 13, 2026
Merged via the queue into apache:main with commit 7ae2374 Jun 13, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci changes related to CI common dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add unit test coverage for ConfigParserUtil

4 participants