test: share postgres container across suites - #1934
RushikeshBhavsar3605 wants to merge 4 commits into
Conversation
|
@RushikeshBhavsar3605 is attempting to deploy a commit to the Raystack Team on Vercel. A member of the Team first needs to authorize it. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: raystack/frontier/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
💤 Files with no reviewable changes (2)
Included review availability: Your plan provides up to 2 included reviews per hour; 0 remain after this review. 📝 SummarySummary by CodeRabbit
WalkthroughMigration commands now defer resource closure, and database initialization closes a connection after a failed ping. PostgreSQL integration tests share one Docker container, migrate a template database once, and create unique databases for test clients. ChangesDatabase resource lifecycle
Shared PostgreSQL test fixture
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Other · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to The PostgreSQL suites now share a container while using isolated databases, and the previously reported stale test call is corrected. No concrete merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID: 65be7a0f-0552-41eb-85de-b59e606a3e67
📒 Files selected for processing (2)
cmd/migrate.gointernal/store/postgres/postgres_test.go
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.
rohilsurana
left a comment
There was a problem hiding this comment.
Went through this properly and also ran it locally. The speedup is real, so thanks for picking it up. A few things I noticed while reading. None of these are hard blockers on their own, and I have left a separate note about the rebase.
|
Could you rebase this on the latest #1929 merged after you cut this branch, and it added The checks on this PR are green, but that run is from 17 Sep and #1929 went in on 21 Sep. CI has not built the two together yet, so the green tick does not cover this. The fix is the same edit you already made to the other 22 suites. Point that file's On the change itself, I ran it locally and the numbers hold up well:
The part I like most is that the |
6a9d5de to
f1d2a5d
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: raystack/frontier/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID: 471e596a-67c0-4cd3-9b60-1e9b1f6ce1bf
📒 Files selected for processing (29)
cmd/migrate.gointernal/store/postgres/audit_record_repository_test.gointernal/store/postgres/billing_customer_repository_test.gointernal/store/postgres/billing_product_repository_test.gointernal/store/postgres/billing_transactions_repository_pg_test.gointernal/store/postgres/domain_repository_test.gointernal/store/postgres/group_repository_test.gointernal/store/postgres/invitation_repository_test.gointernal/store/postgres/kyc_repository_test.gointernal/store/postgres/lock_test.gointernal/store/postgres/namespace_repository_test.gointernal/store/postgres/org_serviceuser_repository_pg_test.gointernal/store/postgres/org_users_repository_pg_test.gointernal/store/postgres/organization_repository_test.gointernal/store/postgres/permission_repository_test.gointernal/store/postgres/policy_repository_test.gointernal/store/postgres/postgres_test.gointernal/store/postgres/preference_repository_test.gointernal/store/postgres/project_repository_test.gointernal/store/postgres/prospect_repository_test.gointernal/store/postgres/relation_repository_test.gointernal/store/postgres/resource_repository_test.gointernal/store/postgres/role_repository_test.gointernal/store/postgres/serviceuser_repository_test.gointernal/store/postgres/user_consent_repository_test.gointernal/store/postgres/user_repository_test.gointernal/store/postgres/userpat_repository_test.gointernal/store/postgres/webhook_endpoint_repository_test.gopkg/db/db.go
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.
|
Rebased onto the latest |
Summary
Fixes #1932.
The Postgres repository tests were starting a separate Postgres container and running migrations for every test suite. This made the package slow and prone to hitting the test timeout.
Changes
TestMainto start and tear down a single Postgres container.test_dbas a template.Test Plan
go test . -count=1go test -race -count=2 .go vet .git diff --check