test(dao): extend SiteSettings unit test coverage with MockTexeraDB - #7255
Conversation
Automated Reviewer SuggestionsBased on the
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7255 +/- ##
============================================
+ Coverage 82.64% 82.68% +0.04%
+ Complexity 4080 4078 -2
============================================
Files 1162 1162
Lines 46282 46282
Branches 5160 5160
============================================
+ Hits 38250 38269 +19
+ Misses 6341 6319 -22
- Partials 1691 1694 +3
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Extends common/dao unit tests for SiteSettings to run against the embedded Postgres via MockTexeraDB, so DB-backed read/write paths (previously uncovered) are exercised without changing production code.
Changes:
- Switches
SiteSettingsSpecto useMockTexeraDB+ embedded Postgres initialization and per-test table cleanup. - Adds DB-backed test cases for
getInt,getLong,upsert, andinsertIfAbsent(including parse-failure/default branches). - Keeps existing pure
parseOrDefaulttests intact.
Suppressed comments (1)
common/dao/src/test/scala/org/apache/texera/dao/SiteSettingsSpec.scala:41
beforeEachshould callsuper.beforeEach()so any other mixed-in fixtures are not skipped if this suite later gains additional traits with setup/teardown logic.
override protected def beforeEach(): Unit =
getDSLContext.deleteFrom(SITE_SETTINGS).execute()
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
| config | throughput | MB/s | latency | max Δ latest / 7d | |
|---|---|---|---|---|---|
| 🔴 | bs=10 sw=10 sl=64 | 450 | 0.275 | 21,682/26,486/26,486 us | 🔴 +13.5% / 🔴 +75.6% |
| 🔴 | bs=100 sw=10 sl=64 | 929 | 0.567 | 106,061/138,685/138,685 us | 🔴 +6.1% / 🔴 +31.0% |
| ⚪ | bs=1000 sw=10 sl=64 | 1,075 | 0.656 | 929,532/1,008,164/1,008,164 us | ⚪ within ±5% / ⚪ within ±5% |
Baseline details
Latest main 436b37e from same runner
| config | metric | PR | latest main | 7d avg | Δ latest | Δ 7d |
|---|---|---|---|---|---|---|
| bs=10 sw=10 sl=64 | throughput | 450 tuples/sec | 470 tuples/sec | 790.88 tuples/sec | -4.3% | -43.1% |
| bs=10 sw=10 sl=64 | MB/s | 0.275 MB/s | 0.287 MB/s | 0.483 MB/s | -4.2% | -43.0% |
| bs=10 sw=10 sl=64 | p50 | 21,682 us | 19,111 us | 12,348 us | +13.5% | +75.6% |
| bs=10 sw=10 sl=64 | p95 | 26,486 us | 30,070 us | 15,390 us | -11.9% | +72.1% |
| bs=10 sw=10 sl=64 | p99 | 26,486 us | 30,070 us | 18,935 us | -11.9% | +39.9% |
| bs=100 sw=10 sl=64 | throughput | 929 tuples/sec | 954 tuples/sec | 1,009 tuples/sec | -2.6% | -7.9% |
| bs=100 sw=10 sl=64 | MB/s | 0.567 MB/s | 0.582 MB/s | 0.616 MB/s | -2.6% | -7.9% |
| bs=100 sw=10 sl=64 | p50 | 106,061 us | 104,081 us | 99,753 us | +1.9% | +6.3% |
| bs=100 sw=10 sl=64 | p95 | 138,685 us | 130,764 us | 105,895 us | +6.1% | +31.0% |
| bs=100 sw=10 sl=64 | p99 | 138,685 us | 130,764 us | 113,263 us | +6.1% | +22.4% |
| bs=1000 sw=10 sl=64 | throughput | 1,075 tuples/sec | 1,096 tuples/sec | 1,037 tuples/sec | -1.9% | +3.6% |
| bs=1000 sw=10 sl=64 | MB/s | 0.656 MB/s | 0.669 MB/s | 0.633 MB/s | -1.9% | +3.6% |
| bs=1000 sw=10 sl=64 | p50 | 929,532 us | 912,103 us | 976,194 us | +1.9% | -4.8% |
| bs=1000 sw=10 sl=64 | p95 | 1,008,164 us | 970,248 us | 1,016,411 us | +3.9% | -0.8% |
| bs=1000 sw=10 sl=64 | p99 | 1,008,164 us | 970,248 us | 1,045,212 us | +3.9% | -3.5% |
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,443.99,200,128000,450,0.275,21682.39,26486.43,26486.43
1,100,10,64,20,2151.82,2000,1280000,929,0.567,106061.23,138685.47,138685.47
2,1000,10,64,20,18605.54,20000,12800000,1075,0.656,929532.39,1008164.26,1008164.26fe92f07 to
e3a125f
Compare
What changes were proposed in this PR?
Extends
SiteSettingsSpec(previously only exercised the pureparseOrDefaulthelper) onto
MockTexeraDBsoSqlServer.createDSLContext()resolves to theembedded Postgres, then covers the DB-hit paths that were red. 6 new tests take
SiteSettingsto 100% (jacoco: 98/98 instructions, 23/23 lines):getInt— returns the stored value when the key is present, the default whenthe key is absent, and the default when the stored value is non-numeric
(the parse-failure branch).
getLong— returns the stored long value.upsert— inserts a new row, then overwrites its value andupdated_by.insertIfAbsent— inserts when absent and leaves an existing value untouched.The existing
parseOrDefaultcases are kept as-is. No production code changed.Any related issues, documentation, discussions?
Closes #7253.
How was this PR tested?
sbt "DAO/testOnly *SiteSettingsSpec"— 11 passed (5 existing + 6 new) againstthe embedded Postgres, with
upsertre-run in isolation to rule outorder-dependence.
sbt "DAO/jacoco"confirmsSiteSettingsis fully covered.The failure path was verified by breaking an assertion (1 failed, non-zero exit),
and
Test/scalafmtCheck+Test/scalafix --checkare clean.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.8 [1M context])