Skip to content

test(amber, common): share the test database lifecycle in auth and resource specs - #9726

Merged
aglinxinyuan merged 2 commits into
apache:mainfrom
aglinxinyuan:test/auth-resource-database-fixtures
Nov 27, 2026
Merged

aglinxinyuan merged 2 commits into
apache:mainfrom
aglinxinyuan:test/auth-resource-database-fixtures

Conversation

@aglinxinyuan

@aglinxinyuan aglinxinyuan commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Fourteen specs that use the embedded test database now extend DatabaseFlatSpec from #9718 instead of opening the database, closing its connection pool and running their cleanup by hand. Each spec keeps its own cleanup() and runs it at the same points as before: before each case, after each case or after the suite.

  • AuthDatabaseSpec, new in the auth test package, is the base of the Apple, Google and ORCID sign-in specs and the local and external account provisioning specs. It holds the user lookup and count by email, the provider-row query, the user cleanup by email domain or provider type and the invite-only switch that these specs each wrote out. The cleanup by email domain refuses an empty domain, which would match every user.
  • The feedback, Gmail, user config, email template and email code specs move the request, message or session user that they built in every case into a helper.

AuthResourceSpec keeps its own setup and helpers for now because #9007 edits it. It can move onto AuthDatabaseSpec once #9007 lands.

Every case keeps its name, inputs and expected values, in the same order.

Any related issues, documentation, discussions?

Closes #9725.

How was this PR tested?

  • sbt "WorkflowExecutionService/testOnly <the 11 suites under amber>", "DAO/testOnly *SiteSettingsSpec", "ComputingUnitManagingService/testOnly <the 3 resource suites>" and "NotebookMigrationService/testOnly *NotebookMigrationResourceSpec": main and this branch each run 266 cases in 16 suites, all passing, with the same names, outcomes and order, compared case by case from the JUnit XML reports.
  • Mutation check: five breaks, each reverted afterwards, made their guarding suites fail:
    • providerIdOf ignoring the provider type it is given: 9 of 58 cases in the five sign-in and provisioning suites.
    • setInviteOnly storing the opposite switch: 6 of 58.
    • userCountByEmail dropping the email domain: 5 cases in the two provisioning suites.
    • GoogleAuthResourceSpec left on the default empty domain: the suite aborts with the new require message instead of deleting every user.
    • DatabaseFlatSpec skipping its before-each cleanup: 19 cases in three suites, and UserConfigResourceSpec aborts when it seeds its two users a second time.
  • sbt "<module>/Test/scalafmtCheck" "<module>/Test/scalafix --check" for WorkflowExecutionService, DAO, ComputingUnitManagingService and NotebookMigrationService.

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

Generated-by: Codex (GPT-6) and Claude Code (Claude Opus 5.5)

…source specs

Fourteen auth, resource and service specs move onto DatabaseFlatSpec, which
opens the embedded database, closes its pool and runs each suite's cleanup
where the suite asks for it. The sign-in and provisioning specs share a new
AuthDatabaseSpec base for their user, provider-row and invite-only helpers,
and five specs build their repeated requests and messages with one helper
each.
Copilot AI balanced review requested due to automatic review settings November 27, 2026 00:40

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions github-actions Bot added engine common platform Non-amber Scala service paths labels Nov 27, 2026
@github-actions

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: @Neilk1021, @anthonychengit, @mengw15
    You can notify them by mentioning @Neilk1021, @anthonychengit, @mengw15 in a comment.

@codecov-commenter

codecov-commenter commented Nov 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.77%. Comparing base (410c55e) to head (a7e5412).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9726      +/-   ##
============================================
- Coverage     91.77%   91.77%   -0.01%     
+ Complexity     5136     5135       -1     
============================================
  Files          1308     1308              
  Lines         58079    58079              
  Branches       7558     7558              
============================================
- Hits          53304    53303       -1     
  Misses         2888     2888              
- Partials       1887     1888       +1     
Flag Coverage Δ *Carryforward flag
access-control-service 77.44% <ø> (ø)
agent-service 99.56% <ø> (ø) Carriedforward from f2206ef
amber 85.95% <ø> (-0.01%) ⬇️
computing-unit-managing-service 63.81% <ø> (ø)
config-service 87.50% <ø> (ø)
file-service 82.16% <ø> (ø)
frontend 96.45% <ø> (ø) Carriedforward from f2206ef
notebook-migration-service 83.84% <ø> (ø)
pyamber 98.70% <ø> (ø) Carriedforward from f2206ef
result-service 86.48% <ø> (ø)
workflow-compiling-service 80.90% <ø> (ø)

*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 Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Benchmark changes need a look

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

Compared against main fec4330 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 375 0.229 24,867/42,214/42,214 us 🟢 -25.3% / 🔴 +211.1%
🟢 bs=100 sw=10 sl=64 866 0.529 113,951/128,025/128,025 us 🟢 -20.6% / 🔴 +40.1%
🔴 bs=1000 sw=10 sl=64 966 0.589 1,024,915/1,176,956/1,176,956 us 🔴 +5.2% / 🔴 +36.9%
Baseline details

Latest main fec4330 from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 375 tuples/sec 329 tuples/sec 951.49 tuples/sec +14.0% -60.6%
bs=10 sw=10 sl=64 MB/s 0.229 MB/s 0.201 MB/s 0.581 MB/s +13.9% -60.6%
bs=10 sw=10 sl=64 p50 24,867 us 30,816 us 10,659 us -19.3% +133.3%
bs=10 sw=10 sl=64 p95 42,214 us 56,532 us 13,570 us -25.3% +211.1%
bs=10 sw=10 sl=64 p99 42,214 us 56,532 us 16,744 us -25.3% +152.1%
bs=100 sw=10 sl=64 throughput 866 tuples/sec 828 tuples/sec 1,256 tuples/sec +4.6% -31.1%
bs=100 sw=10 sl=64 MB/s 0.529 MB/s 0.505 MB/s 0.767 MB/s +4.8% -31.0%
bs=100 sw=10 sl=64 p50 113,951 us 114,296 us 84,170 us -0.3% +35.4%
bs=100 sw=10 sl=64 p95 128,025 us 161,271 us 91,401 us -20.6% +40.1%
bs=100 sw=10 sl=64 p99 128,025 us 161,271 us 104,021 us -20.6% +23.1%
bs=1000 sw=10 sl=64 throughput 966 tuples/sec 979 tuples/sec 1,299 tuples/sec -1.3% -25.6%
bs=1000 sw=10 sl=64 MB/s 0.589 MB/s 0.598 MB/s 0.793 MB/s -1.5% -25.7%
bs=1000 sw=10 sl=64 p50 1,024,915 us 1,016,447 us 819,011 us +0.8% +25.1%
bs=1000 sw=10 sl=64 p95 1,176,956 us 1,118,450 us 859,723 us +5.2% +36.9%
bs=1000 sw=10 sl=64 p99 1,176,956 us 1,118,450 us 909,957 us +5.2% +29.3%
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,533.52,200,128000,375,0.229,24867.33,42213.85,42213.85
1,100,10,64,20,2309.03,2000,1280000,866,0.529,113951.12,128024.59,128024.59
2,1000,10,64,20,20708.65,20000,12800000,966,0.589,1024914.61,1176955.93,1176955.93

@aglinxinyuan
aglinxinyuan requested a review from kunwp1 November 27, 2026 00:56

@kunwp1 kunwp1 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! One optional suggestion and two nits below.

AuthDatabaseSpec now holds userCountByEmail, which the local and external
provisioning specs each wrote out, and deleteUsersByEmailDomain refuses an
empty emailDomain instead of deleting every user. NotebookMigrationResourceSpec
leaves its before-each cleanup to DatabaseFlatSpec instead of calling
cleanup() itself, which runs the same deletes in the same order.
@aglinxinyuan
aglinxinyuan added this pull request to the merge queue Nov 27, 2026
Merged via the queue into apache:main with commit 923c982 Nov 27, 2026
40 checks passed
@aglinxinyuan
aglinxinyuan deleted the test/auth-resource-database-fixtures branch November 27, 2026 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common engine platform Non-amber Scala service paths

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Share the test database lifecycle in auth and resource specs

4 participants