Draft
Conversation
Agent-Logs-Url: https://github.com/readthedocs/readthedocs.org/sessions/badddd82-cf33-4945-a5ca-458a89a07e77 Co-authored-by: humitos <244656+humitos@users.noreply.github.com>
Agent-Logs-Url: https://github.com/readthedocs/readthedocs.org/sessions/badddd82-cf33-4945-a5ca-458a89a07e77 Co-authored-by: humitos <244656+humitos@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update test suite to run with PostgreSQL
Switch test suite from SQLite to PostgreSQL
Apr 9, 2026
humitos
reviewed
Apr 9, 2026
Member
humitos
left a comment
There was a problem hiding this comment.
Looks good so far... let's see if there are tests failing or not.
| DB_USER: docs_user | ||
| DB_PWD: docs_pwd | ||
| DB_HOST: localhost | ||
| - image: 'cimg/postgres:14.0' |
Member
There was a problem hiding this comment.
Suggested change
| - image: 'cimg/postgres:14.0' | |
| - image: 'cimg/postgres:16.3' |
We are using version 16.3 locally, so we should use the same if it's available.
| DB_USER: docs_user | ||
| DB_PWD: docs_pwd | ||
| DB_HOST: localhost | ||
| - image: 'cimg/postgres:14.0' |
Comment on lines
+112
to
+120
| "HOST": os.environ.get("DB_HOST", "localhost"), | ||
| "PORT": "", | ||
| }, | ||
| "telemetry": { | ||
| "ENGINE": "django.db.backends.sqlite3", | ||
| "NAME": os.path.join(self.SITE_ROOT, "telemetry.dev.db"), | ||
| "ENGINE": "django.db.backends.postgresql_psycopg2", | ||
| "NAME": "test_telemetry", | ||
| "USER": os.environ.get("DB_USER", "docs_user"), | ||
| "PASSWORD": os.environ.get("DB_PWD", "docs_pwd"), | ||
| "HOST": os.environ.get("DB_HOST", "localhost"), |
Member
There was a problem hiding this comment.
Locally it runs in another container, so we need to use database as a host.
Suggested change
| "HOST": os.environ.get("DB_HOST", "localhost"), | |
| "PORT": "", | |
| }, | |
| "telemetry": { | |
| "ENGINE": "django.db.backends.sqlite3", | |
| "NAME": os.path.join(self.SITE_ROOT, "telemetry.dev.db"), | |
| "ENGINE": "django.db.backends.postgresql_psycopg2", | |
| "NAME": "test_telemetry", | |
| "USER": os.environ.get("DB_USER", "docs_user"), | |
| "PASSWORD": os.environ.get("DB_PWD", "docs_pwd"), | |
| "HOST": os.environ.get("DB_HOST", "localhost"), | |
| "HOST": os.environ.get("DB_HOST", "database"), | |
| "PORT": "", | |
| }, | |
| "telemetry": { | |
| "ENGINE": "django.db.backends.postgresql_psycopg2", | |
| "NAME": "test_telemetry", | |
| "USER": os.environ.get("DB_USER", "docs_user"), | |
| "PASSWORD": os.environ.get("DB_PWD", "docs_pwd"), | |
| "HOST": os.environ.get("DB_HOST", "database"), |
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.
SQLite doesn't support certain JSON field queries used in production, making those code paths untestable. Aligns test environment with production PostgreSQL.
Changes
readthedocs/settings/test.py— Replace SQLite withpostgresql_psycopg2for bothdefaultandtelemetrydatabases; credentials viaDB_USER/DB_PWD/DB_HOSTenv vars (defaults:docs_user/docs_pwd/localhost):tox.ini— AddDB_USER,DB_PWD,DB_HOSTtopassenvso they propagate into the tox virtualenv..circleci/config.yml— Addcimg/postgres:14.0sidecar totests,tests-search, andtests-proxitojobs; add a reusablewait-for-postgrescommand that polls readiness viapg_isreadyand explicitly creates thetest_telemetrydatabase (test_docs_dbis created automatically viaPOSTGRES_DB); installpostgresql-clientin each affected job.