GORM migration: extract sqltest suite#7120
Open
MarcosDY wants to merge 5 commits into
Open
Conversation
Signed-off-by: Marcos Yacob <marcosyacob@gmail.com>
Signed-off-by: Marcos Yacob <marcosyacob@gmail.com>
There was a problem hiding this comment.
Pull request overview
This PR refactors the SQL datastore conformance test suite out of the sqlstore package into a new shared pkg/server/datastore/sqltest package so multiple SQL datastore implementations (e.g., future GORM v2) can be validated against the same test corpus.
Changes:
- Introduces
pkg/server/datastore/sqltestwith a parameterized shared suite (Config,DataStoreUnderTest, andRawQuerierescape hatch). - Adapts the existing sqlstore (v1) tests to run the shared suite via
sqltest.Run(...). - Exposes test-support raw SQL helpers (
RawScan,RawExec,DatabaseType,Rebind) on*sqlstore.Pluginfor cross-package suite needs.
Reviewed changes
Copilot reviewed 4 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/server/datastore/sqltest/suite.go | Defines the shared suite entrypoint (Run) and the datastore-under-test contract. |
| pkg/server/datastore/sqltest/rawquerier.go | Declares the raw SQL escape-hatch interface exercised by the shared tests. |
| pkg/server/datastore/sqltest/datastore_suite.go | Contains the extracted, parameterized conformance tests previously hosted in sqlstore tests. |
| pkg/server/datastore/sqlstore/sqltest_assert_test.go | Compile-time assertions that *Plugin satisfies the shared suite contracts. |
| pkg/server/datastore/sqlstore/sqlstore.go | Adds exported raw SQL helper methods on *Plugin for the shared suite. |
| pkg/server/datastore/sqlstore/sqlstore_test.go | Replaces the in-package PluginSuite with sqltest.Run(...) and keeps remaining whitebox tests local. |
Signed-off-by: Marcos Yacob <marcosyacob@gmail.com>
Signed-off-by: Marcos Yacob <marcosyacob@gmail.com>
Collaborator
Author
|
@sorindumitru there was a flaky test on windows I applied a change to try to resolve lets me know what do you think |
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.
Pull Request check list
Affected functionality
The SQL datastore test suite.
This is a test-only refactor, no production datastore behavior changes.
It's the second step of the ongoing work to allow an optional gorm v2 datastore to live alongside the existing one, following the sqlcommon extraction that already merged (#7114).
Description of change
The test suite (the big PluginSuite) used to live inside the sqlstore package's test file, so only the v1 datastore could run it. This PR lifts it out into a new shared pkg/server/datastore/sqltest package, parameterized over a datastore factory, so a future gorm v2 datastore can be validated against the exact same tests.
A few decisions worth calling out, in case you'd have done them differently:
No docs change — this is test infrastructure only.
Which issue this PR fixes
Part of #1832