Repository navigation
test(amber, common): share the test database lifecycle in auth and resource specs - #9726
Conversation
…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.
Automated Reviewer SuggestionsBased on the
|
Codecov Report✅ All modified and coverable lines are covered by tests. 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
*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:
|
|
| 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
kunwp1
left a comment
There was a problem hiding this comment.
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.
What changes were proposed in this PR?
Fourteen specs that use the embedded test database now extend
DatabaseFlatSpecfrom #9718 instead of opening the database, closing its connection pool and running their cleanup by hand. Each spec keeps its owncleanup()and runs it at the same points as before: before each case, after each case or after the suite.AuthDatabaseSpec, new in theauthtest 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.AuthResourceSpeckeeps its own setup and helpers for now because #9007 edits it. It can move ontoAuthDatabaseSpeconce #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.providerIdOfignoring the provider type it is given: 9 of 58 cases in the five sign-in and provisioning suites.setInviteOnlystoring the opposite switch: 6 of 58.userCountByEmaildropping the email domain: 5 cases in the two provisioning suites.GoogleAuthResourceSpecleft on the default empty domain: the suite aborts with the newrequiremessage instead of deleting every user.DatabaseFlatSpecskipping its before-each cleanup: 19 cases in three suites, andUserConfigResourceSpecaborts when it seeds its two users a second time.sbt "<module>/Test/scalafmtCheck" "<module>/Test/scalafix --check"forWorkflowExecutionService,DAO,ComputingUnitManagingServiceandNotebookMigrationService.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Codex (GPT-6) and Claude Code (Claude Opus 5.5)