-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Download example databases for use in CI tests #608
Merged
Merged
Changes from 6 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
62b7f1e
💽 Create SQL test data and dockerfile spec
Kezzsim 10cbf89
Remove large binary file from history w/git-filter
Kezzsim ee78c04
Rely on externally provided example data.
danielballan e8cc08e
Remove slow-test code, no longer needed.
danielballan 01722b6
Skip test if example database does not exist.
danielballan 11fe5e2
Merge branch 'adapter-fixture' into sql-cache-ci
danielballan a8c0d1a
Docker container no longer hosted here
Kezzsim 8d623b0
Merge branch 'bluesky:main' into sql-cache-ci
Kezzsim 03dd13b
Merge branch 'bluesky:main' into sql-cache-ci
Kezzsim 0551a63
Download, get and mount 💾 .sql data (empty)
Kezzsim 672f9ab
Correct mountpoint 🐳
Kezzsim 23e134c
Namespaced test database deployment 📇
Kezzsim 74804fb
Merge branch 'bluesky:main' into sql-cache-ci
Kezzsim 27a2216
Pin Postgres image to ensure compat with .sql dump.
danielballan 97cfc5d
Use curl instead of wget; make script idempotent.
danielballan 318fb0a
Download sqlite data.
danielballan f51cbc3
Test against SQLite with example data
danielballan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
FROM docker.io/postgres | ||
# Uses the initialization scripts (https://hub.docker.com/_/postgres/) | ||
# Creates Database automatically from SQL file | ||
COPY postgres-ci-db.sql /docker-entrypoint-initdb.d/init-user-db.sql |
This file contains 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
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For ease of use, it seems like it would be convenient to keep
startup()
andshutdown()
in the fixtures. Is it straightforward to add a guard tostartup()
that checks whether it has already been called or whether an app is running?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do dislike this structure and would welcome suggestions to improve it.
The problem is that startup must be called on the same thread where the application will run. If this adapter is going to be used by the
TestClient, via
Context.from_app(build_app(adapter)), a background thread is created at that point and
startup()` needs to be run on that thread.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. In that case, I think the solution using the fixture
a
is probably already optimal.One could of course add fixture
b
(or equivalent) fortest_metadata_index_is_used(b)
-- if you expect additional tests that would make use ofpostgresql_with_example_data_adapter
:However, a DRYer and more composable version might look like this...
Marking the parameter as
indirect
will override the argument passed to a parameterized fixture. See "Indirect parametrization" |parametrize
| and especially this informative example.