-
Notifications
You must be signed in to change notification settings - Fork 2
Add a real Django/DB-backed integration test tier for the endpoint trust boundary #164
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
Merged
wpak-ai
merged 4 commits into
cppalliance:develop
from
whisper67265:feature/db-integration-test
Jul 8, 2026
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # SPDX-FileCopyrightText: 2026 Andrew Zhang <whisper67265@outlook.com> | ||
| # | ||
| # SPDX-License-Identifier: BSL-1.0 | ||
|
|
||
| name: PostgreSQL tests | ||
|
|
||
| on: | ||
| workflow_call: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| postgres: | ||
| name: PostgreSQL tests (Python 3.12) | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
| services: | ||
| postgres: | ||
| image: postgres:16-alpine | ||
| env: | ||
| POSTGRES_USER: weblate | ||
| POSTGRES_PASSWORD: weblate | ||
| POSTGRES_DB: weblate | ||
| ports: | ||
| - 5432:5432 | ||
| options: >- | ||
| --health-cmd pg_isready | ||
| --health-interval 5s | ||
| --health-timeout 3s | ||
| --health-retries 10 | ||
| steps: | ||
| # actions/checkout v6.0.2 | ||
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 | ||
| with: | ||
| persist-credentials: false | ||
| # actions/setup-python v6.2.0 | ||
| - name: Setup Python | ||
| uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 | ||
| with: | ||
| python-version: '3.12' | ||
| # astral-sh/setup-uv v8.1.0 | ||
| - uses: astral-sh/setup-uv@d31148d669074a8d0a63714ba94f3201e7020bc3 | ||
| with: | ||
| version: 0.11.12 | ||
| - name: Install apt dependencies (Weblate venv) | ||
| run: sudo ./.github/ci/apt-install | ||
| - name: Install dependencies (incl. dev) | ||
| run: uv sync --frozen --group dev | ||
| - name: Pytest postgres tier | ||
| env: | ||
| DJANGO_SETTINGS_MODULE: tests.django_integration_settings | ||
| CI_DB_HOST: 127.0.0.1 | ||
| CI_DB_USER: weblate | ||
| CI_DB_PASSWORD: weblate | ||
| CI_DB_NAME: weblate | ||
| run: > | ||
| uv run --group dev pytest -m postgres -v --tb=short --reuse-db |
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # SPDX-FileCopyrightText: 2026 Andrew Zhang <whisper67265@outlook.com> | ||
| # | ||
| # SPDX-License-Identifier: BSL-1.0 | ||
|
|
||
| """Django settings for DB-backed integration tests. | ||
|
|
||
| Extends Weblate's ``settings_test`` (PostgreSQL, eager Celery, full migrations) | ||
| with the Boost endpoint app and throttle configuration. | ||
|
|
||
| Requires a PostgreSQL server. Configure via ``CI_DB_*`` environment variables | ||
| (same contract as upstream Weblate CI):: | ||
|
|
||
| export CI_DB_HOST=127.0.0.1 | ||
| export CI_DB_USER=weblate | ||
| export CI_DB_PASSWORD=weblate | ||
| export CI_DB_NAME=weblate | ||
| DJANGO_SETTINGS_MODULE=tests.django_integration_settings pytest -m postgres | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from weblate.settings_test import * # noqa: F403 | ||
|
|
||
| from boost_weblate.settings_override import merge_boost_endpoint_throttle_rates | ||
|
|
||
| _ENDPOINT_APP_CONFIG = "boost_weblate.endpoint.apps.BoostEndpointConfig" | ||
|
|
||
| REST_FRAMEWORK = merge_boost_endpoint_throttle_rates(REST_FRAMEWORK) # noqa: F405 | ||
|
|
||
| if _ENDPOINT_APP_CONFIG not in INSTALLED_APPS: # noqa: F405 | ||
| INSTALLED_APPS += (_ENDPOINT_APP_CONFIG,) # noqa: F405 |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # SPDX-FileCopyrightText: 2026 Andrew Zhang <whisper67265@outlook.com> | ||
| # | ||
| # SPDX-License-Identifier: BSL-1.0 |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.