test: enable dormant DB integration tests against testcontainers - #369
Open
mrofreP wants to merge 1 commit into
Open
test: enable dormant DB integration tests against testcontainers#369mrofreP wants to merge 1 commit into
mrofreP wants to merge 1 commit into
Conversation
integration/database_integration_test.go was written before the
testcontainers-backed integration harness (main_test.go) landed and
was never re-enabled. Every top-level test and benchmark starts with
an unconditional t.Skip("... requires actual database setup"), while
main_test.go already provisions a real Postgres container and exposes
it via the package-level db (*models.Queries) and dbPool.
Wire the tests to the existing harness, drop the unconditional skips,
and delete three pure-placeholder tests whose bodies were just t.Log
("would be implemented here"): TestTransactionIntegrity,
TestConcurrentOperations, TestPerformanceQueries. They were dead
scaffolding, not tests.
Also:
- Remove the unused local queries *models.Queries var and its stub
setupTestDatabase helper; database/sql import goes with them.
- testUserOperations now creates a per-run unique user with a valid
username length and all required fields (language_id, question_id,
verificationdata, signup_ts, last_updated_by), matching the pattern
used in manager_change_test.go's setupTestChannelAndUser.
- testChannelOperations / testChannelMembershipOperations /
testComplexQueries keep their defensive t.Skip guards for the
seeded-data cases, which is the correct behavior when running
against a clean container.
- BenchmarkChannelSearch and BenchmarkUserChannelMemberships lose
their unconditional skips but keep the short-mode guard.
Net effect: TestDatabaseIntegration now runs 4 subtests
(User/Channel/Membership/Complex) against the real Postgres, adding
integration coverage to the sqlc-generated models package that
previously had 0% unit coverage.
Up to standards ✅🟢 Issues
|
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.
integration/database_integration_test.go was written before the
testcontainers-backed integration harness (main_test.go) landed and
was never re-enabled. Every top-level test and benchmark starts with
an unconditional t.Skip("... requires actual database setup"), while
main_test.go already provisions a real Postgres container and exposes
it via the package-level db (*models.Queries) and dbPool.
Wire the tests to the existing harness, drop the unconditional skips,
and delete three pure-placeholder tests whose bodies were just t.Log
("would be implemented here"): TestTransactionIntegrity,
TestConcurrentOperations, TestPerformanceQueries. They were dead
scaffolding, not tests.
Also:
setupTestDatabase helper; database/sql import goes with them.
username length and all required fields (language_id, question_id,
verificationdata, signup_ts, last_updated_by), matching the pattern
used in manager_change_test.go's setupTestChannelAndUser.
testComplexQueries keep their defensive t.Skip guards for the
seeded-data cases, which is the correct behavior when running
against a clean container.
their unconditional skips but keep the short-mode guard.
Net effect: TestDatabaseIntegration now runs 4 subtests
(User/Channel/Membership/Complex) against the real Postgres, adding
integration coverage to the sqlc-generated models package that
previously had 0% unit coverage.