Migrate remaining tests from SQL fixtures to JSON import#176
Merged
Migrate remaining tests from SQL fixtures to JSON import#176
Conversation
This patch migrates the last 5 tests from SQL fixtures to JSON imports, and removes the old scripts that are not necessary anymore. This effectively makes all the tests use Postgres instead of SQLite, which means that we should catch more issues before they make it to production (which always uses Postgres). Some details about the change: In Python tests all hardcoded database IDs are replaced with dynamic API lookups (machines by name, tests by name, runs by revision). This is awkward, but it's necessary since database IDs are internal to the DB, and they are not stable across SQLite and Postgres. In the future, a new API could elimintate this awkwardness by not being based on hardcoded DB IDs. Assisted-by: Claude
5a320b2 to
be1b310
Compare
ldionne
commented
Mar 24, 2026
| app.testing = True | ||
| self.client = app.test_client() | ||
|
|
||
| # Build ID maps for dynamic lookups. |
Member
Author
There was a problem hiding this comment.
I'm not very happy with this, but I think it's a necessary evil since the current API leaks IDs left and right. I looked into other ways to do this but at the end of the day, they're all just as bad.
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.
This patch migrates the last 5 tests from SQL fixtures to JSON imports,
and removes the old scripts that are not necessary anymore. This
effectively makes all the tests use Postgres instead of SQLite,
which means that we should catch more issues before they make it
to production (which always uses Postgres).
Some details about the change: In Python tests all hardcoded database
IDs are replaced with dynamic API lookups (machines by name, tests by
name, runs by revision). This is awkward, but it's necessary since
database IDs are internal to the DB, and they are not stable across
SQLite and Postgres. In the future, a new API could elimintate this
awkwardness by not being based on hardcoded DB IDs.
Assisted-by: Claude