Skip to content

Migrate remaining tests from SQL fixtures to JSON import#176

Merged
ldionne merged 2 commits intollvm:mainfrom
ldionne:review/test-postgres-for-real
Mar 24, 2026
Merged

Migrate remaining tests from SQL fixtures to JSON import#176
ldionne merged 2 commits intollvm:mainfrom
ldionne:review/test-postgres-for-real

Conversation

@ldionne
Copy link
Copy Markdown
Member

@ldionne ldionne commented Mar 12, 2026

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

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
@ldionne ldionne force-pushed the review/test-postgres-for-real branch from 5a320b2 to be1b310 Compare March 24, 2026 16:55
@ldionne ldionne changed the title [CI] Actually use Postgres in the tests Migrate remaining tests from SQL fixtures to JSON import Mar 24, 2026
app.testing = True
self.client = app.test_client()

# Build ID maps for dynamic lookups.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@ldionne ldionne merged commit 8f8dad7 into llvm:main Mar 24, 2026
15 checks passed
@ldionne ldionne deleted the review/test-postgres-for-real branch March 24, 2026 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant