Skip to content

test(dao): extend SiteSettings unit test coverage with MockTexeraDB - #7255

Merged
aglinxinyuan merged 1 commit into
apache:mainfrom
mengw15:chore/7253-sitesettings-test
Aug 3, 2026
Merged

test(dao): extend SiteSettings unit test coverage with MockTexeraDB#7255
aglinxinyuan merged 1 commit into
apache:mainfrom
mengw15:chore/7253-sitesettings-test

Conversation

@mengw15

@mengw15 mengw15 commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Extends SiteSettingsSpec (previously only exercised the pure parseOrDefault
helper) onto MockTexeraDB so SqlServer.createDSLContext() resolves to the
embedded Postgres, then covers the DB-hit paths that were red. 6 new tests take
SiteSettings to 100% (jacoco: 98/98 instructions, 23/23 lines):

  • getInt — returns the stored value when the key is present, the default when
    the 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 and updated_by.
  • insertIfAbsent — inserts when absent and leaves an existing value untouched.

The existing parseOrDefault cases 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) against
the embedded Postgres, with upsert re-run in isolation to rule out
order-dependence. sbt "DAO/jacoco" confirms SiteSettings is fully covered.
The failure path was verified by breaking an assertion (1 failed, non-zero exit),
and Test/scalafmtCheck + Test/scalafix --check are clean.

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

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

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @Ma77Ball
    You can notify them by mentioning @Ma77Ball in a comment.

@codecov-commenter

codecov-commenter commented Aug 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.68%. Comparing base (436b37e) to head (e3a125f).

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     
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø)
agent-service 83.65% <ø> (ø) Carriedforward from 436b37e
amber 79.41% <ø> (+0.11%) ⬆️
computing-unit-managing-service 43.60% <ø> (ø)
config-service 65.97% <ø> (ø)
file-service 66.80% <ø> (ø)
frontend 83.55% <ø> (ø) Carriedforward from 436b37e
notebook-migration-service 78.89% <ø> (ø)
pyamber 97.36% <ø> (ø) Carriedforward from 436b37e
workflow-compiling-service 26.31% <ø> (ø)

*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.

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

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 SiteSettingsSpec to use MockTexeraDB + embedded Postgres initialization and per-test table cleanup.
  • Adds DB-backed test cases for getInt, getLong, upsert, and insertIfAbsent (including parse-failure/default branches).
  • Keeps existing pure parseOrDefault tests intact.
Suppressed comments (1)

common/dao/src/test/scala/org/apache/texera/dao/SiteSettingsSpec.scala:41

  • beforeEach should call super.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.

Comment thread common/dao/src/test/scala/org/apache/texera/dao/SiteSettingsSpec.scala Outdated
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

⚠️ Benchmark changes need a look

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

Compared against main 436b37e benchmarked on this same runner, so the delta is largely free of cross-runner hardware noise. The "7d avg" column still reflects the gh-pages dashboard. Treat <±5% as noise unless repeated.

Dashboard · Run

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.26

@mengw15
mengw15 requested a review from aglinxinyuan August 2, 2026 14:17
@mengw15
mengw15 force-pushed the chore/7253-sitesettings-test branch from fe92f07 to e3a125f Compare August 2, 2026 15:01

@aglinxinyuan aglinxinyuan 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.

LGTM!

@aglinxinyuan
aglinxinyuan added this pull request to the merge queue Aug 3, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 3, 2026
@aglinxinyuan
aglinxinyuan added this pull request to the merge queue Aug 3, 2026
Merged via the queue into apache:main with commit 8b9b6b7 Aug 3, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

extend SiteSettings unit test coverage with MockTexeraDB

4 participants