test: add Orm.Connection dbConfig coverage and optimize tests/feature runtime (framework#1540) - #147
Merged
Conversation
- Scope the 3 driver-agnostic Orm.Connection/migrator tests to sqlite only (they were re-run redundantly under postgres/mysql/sqlserver by TestDBDrivers). - Hoist the broadcast suite's queue.default=database override to SetupSuite, dropping ~18 app.Restart() calls; opt 3 sync-reliant tests back into sync. - Convert fixed-sleep job-consumption assertions to Eventually polling and defer worker.Shutdown() to avoid goroutine leaks. - Tighten disabled_runners wait windows (3s/2s -> 1s/1s).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
facades.Orm().Connection(name)now returns an ORM bound to the requested connection's own config on every call — the cached/warm path and 20 concurrent callers no longer leak the default connection's name and database; coverage exercises the cold, warm, and concurrent paths against the framework#1540 fix build.tests/featuresuite runtime drops from ~600s to ~400s: the driver-agnostic Orm/migrator tests now run only under sqlite (they were re-run redundantly by TestDBDrivers for postgres/mysql/sqlserver), the broadcast suite'squeue.default: "database"override is hoisted to SetupSuite (saving ~18 app restarts), sync-reliant tests opt back into the sync queue, fixed-sleep job-consumption checks became Eventually polls, and workers get a deferred shutdown to avoid goroutine leaks.Closes https://github.com/goravel/goravel/issues/1540
Why
Framework#1540 fixes two ways a non-default database connection could leak into shared state.
Orm.Connectioncached the ORM per connection name but always returned the parentdbConfig, so a secondConnection("reporting")call reported the default connection's name and database; and the migrator logged its ledger row while still switched to the migration's target connection, so the ledger landed in the wrong database. This branch pins the example to the fix build and adds feature coverage that locks both behaviors down.While working in
tests/featurethe suite was pushing past the CI-timeout 10m. The change scopes the three driver-agnostic Orm/migrator tests to sqlite only, hoists the broadcast suite'squeue.default: "database"override into SetupSuite to drop ~18app.Restart()calls, opts the three sync-reliant full-flow tests back into the sync queue, and replaces fixed-sleep job-consumption assertions withEventuallypolling plus deferred worker shutdown. No assertion was weakened; the suite now completes in ~400s.