Skip to content

Add integration-smoke workflow.#72

Merged
wpak-ai merged 7 commits into
cppalliance:developfrom
whisper67265:feature/integration-smoke
May 27, 2026
Merged

Add integration-smoke workflow.#72
wpak-ai merged 7 commits into
cppalliance:developfrom
whisper67265:feature/integration-smoke

Conversation

@whisper67265
Copy link
Copy Markdown
Collaborator

@whisper67265 whisper67265 commented May 27, 2026

Close #55.
Close #56.
Close #57.
Close #58.

Summary by CodeRabbit

  • Documentation

    • Added Docker and scripts docs showing how to build/run a Weblate + Postgres + Redis stack and run local integration smoke tests.
  • Tests

    • Added a P0 integration smoke test suite validating plugin install, health endpoints, formats, and authenticated info routes.
    • Added test helpers and fixtures for HTTP checks and executing code inside the running stack.
  • Chores

    • Added Docker Compose/image support, stack management scripts, and a CI workflow to run the smoke tests; updated test config to opt-in integrations.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 77e5eae4-cf10-44b9-a1f7-e64a69b66c68

📥 Commits

Reviewing files that changed from the base of the PR and between fc38722 and 99af7ff.

📒 Files selected for processing (4)
  • .github/workflows/integration-smoke.yml
  • scripts/integration-smoke.sh
  • scripts/lib/weblate-stack.sh
  • tests/integration/lib/docker_exec.py
🚧 Files skipped from review as they are similar to previous changes (4)
  • .github/workflows/integration-smoke.yml
  • scripts/integration-smoke.sh
  • tests/integration/lib/docker_exec.py
  • scripts/lib/weblate-stack.sh

📝 Walkthrough

Walkthrough

Adds a Docker Compose stack (Postgres, Redis, Weblate with plugin), Dockerfile overlay, bash orchestration and lifecycle scripts, integration test helpers and pytest fixtures, a P0 smoke test suite exercising plugin import and endpoints, and a GitHub Actions workflow to run the smoke tests and collect logs on failure.

Changes

Integration Testing Stack

Layer / File(s) Summary
Docker Stack Definition
docker/docker-compose.yml, docker/Dockerfile.weblate-plugin, docker/README.md
Multi-service stack with PostgreSQL 16, Redis 7, and Weblate container built from a custom Dockerfile that installs the plugin, copies settings-override.py, and clones from PLUGIN_GIT_URL/PLUGIN_GIT_REF if needed; includes healthchecks and usage docs.
Stack Orchestration Scripts
scripts/lib/compose.sh, scripts/lib/weblate-stack.sh, scripts/integration-smoke.sh, scripts/README.md
Bash helpers export REPO_ROOT, COMPOSE_FILE, COMPOSE_PROJECT_NAME, provide compose() wrapper, and lifecycle functions: stack_build(), stack_up(), stack_wait_healthy() (polls /healthz/ with timeout and log tail), stack_create_token(), stack_logs(), stack_down(). Includes CI entrypoint script wiring.
Test Execution Helpers
tests/integration/lib/docker_exec.py, tests/integration/lib/http.py
docker_exec_python() / docker_exec_python_json() run Python inside the Weblate container with timeout and error capture; http_json() and http_get() perform stdlib HTTP requests with optional Bearer token and JSON-or-text response parsing.
Pytest Integration Fixtures
tests/integration/conftest.py
Session-scoped fixtures: api_token() reads WEBLATE_API_TOKEN and skips if unset, live_base_url() returns base URL, authed_get() pre-binds Bearer token, exec_python() and exec_python_json() expose container execution helpers.
Integration Smoke Test Suite
tests/integration/test_smoke.py
P0 smoke tests verify /healthz/ 200, boost_weblate import and registration in INSTALLED_APPS/WEBLATE_FORMATS, QuickBookFormat attributes (format_id, monolingual, autoload), and boost endpoints /boost-endpoint/plugin-ping/ and /boost-endpoint/info/ (auth behavior and JSON shape).
CI Workflow and Manifest
.github/workflows/integration-smoke.yml, pyproject.toml
GitHub Actions workflow triggers on main/develop, runs Python 3.12, executes scripts/integration-smoke.sh which builds/starts the stack, waits for health, creates an API token, runs pytest smoke tests, collects logs to /tmp/compose-logs.txt on failure; pyproject.toml excludes integration tests by default and includes docker/** and scripts/** in build sources.

Sequence Diagram

sequenceDiagram
  participant GitHub as GitHub Actions
  participant Smoke as integration-smoke.sh
  participant StackLib as weblate-stack.sh
  participant Compose as Docker Compose
  participant Weblate as Weblate container
  participant Pytest as pytest
  participant Artifact as Artifact Upload

  GitHub->>Smoke: workflow trigger
  Smoke->>StackLib: call stack_build()
  StackLib->>Compose: compose build (weblate image)
  Compose-->>StackLib: image ready
  Smoke->>StackLib: stack_up()
  Compose-->>Weblate: containers started
  Smoke->>StackLib: stack_wait_healthy()
  StackLib->>Weblate: poll /healthz/ until 200
  Weblate-->>StackLib: healthy
  Smoke->>StackLib: stack_create_token(admin)
  StackLib->>Weblate: exec python → create token
  Weblate-->>Smoke: token (stdout)
  Smoke->>Pytest: install & run tests/integration/test_smoke.py
  Pytest->>Weblate: HTTP checks & container-exec assertions
  Weblate-->>Pytest: responses
  Pytest-->>Smoke: test results
  Smoke->>StackLib: stack_logs() → /tmp/compose-logs.txt (on failure)
  Smoke->>StackLib: stack_down()
  GitHub->>Artifact: upload /tmp/compose-logs.txt (on failure)
Loading

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • henry0816191
  • wpak-ai

Poem

🐰 I dug a tunnel through compose and logs,
Built a stack of Postgres, Redis, and frogs.
I seeded a token, then hopped to the test,
Endpoints said "ok" — my little heart blessed.
CI packs the logs; I nibble a jest.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add integration-smoke workflow' directly matches the main addition: a new GitHub Actions workflow file (.github/workflows/integration-smoke.yml).
Linked Issues check ✅ Passed The PR successfully implements all core requirements from issues #55-#58: the integration-smoke workflow, docker compose stack, dockerfile overlay, pytest markers, scripts for stack management, smoke tests validating container boot/plugin load/format registration/endpoint routing.
Out of Scope Changes check ✅ Passed All changes directly support the five linked issues: workflow, docker assets, shell scripts, test infrastructure, and pytest config align with #55#58 requirements with no extraneous modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/integration-smoke.yml:
- Around line 18-29: Replace floating action refs with pinned commit SHAs and
explicitly disable checkout credential persistence: update the steps using
actions/checkout, actions/setup-python, and actions/upload-artifact to use their
corresponding commit SHA refs instead of `@v4/`@v5/@v4, and add
persist-credentials: false to the actions/checkout step (the step referencing
actions/checkout) so credentials are not persisted to the workspace; ensure the
Run integration smoke tests and Upload logs on failure steps continue to
reference the same action step names (Run integration smoke tests, Upload logs
on failure) when making these changes.

In `@docker/docker-compose.yml`:
- Around line 14-15: Replace the weak fallbacks for DB credentials with a
fail-closed approach: remove the hardcoded defaults in the docker-compose env
substitutions (e.g., change POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-weblate} to
require POSTGRES_PASSWORD without a default) or implement secure
generation/validation at startup; ensure the same change is applied to the other
occurrences noted (the admin/ weblate fallbacks around lines 45–50). Update
references to POSTGRES_PASSWORD (and any POSTGRES_USER/POSTGRES_DB defaults) so
the service fails fast when those env vars are not provided, or wire in a secure
random-secret generator in the container entrypoint to populate them instead.

In `@docker/Dockerfile.weblate-plugin`:
- Line 9: The Dockerfile currently uses the floating base image reference
"weblate/weblate:latest" in the FROM instruction; update that FROM line to pin
to a stable, reproducible tag or an exact sha256 digest (e.g., replace
"weblate/weblate:latest" with a specific version tag like
"weblate/weblate:<version>" or "weblate/weblate@sha256:<digest>"); obtain the
desired tag/digest from the official Weblate Docker Hub/GitHub release, update
the FROM reference in Dockerfile.weblate-plugin accordingly, and commit the
change so CI uses a fixed image.

In `@scripts/integration-smoke.sh`:
- Around line 15-21: The cleanup() function should be made best-effort by
disabling errexit at its start so teardown always runs: capture the original
exit code into local exit_code as-is, run set +e (or otherwise disable -e)
before calling stack_logs and stack_down so failures there don't abort the rest
of cleanup, ensure both stack_logs and stack_down are executed even if one
fails, and finally exit with the preserved exit_code; reference the cleanup
function and the stack_logs and stack_down calls when making this change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1b21d530-fc3e-4d4d-9618-39d7e85f2159

📥 Commits

Reviewing files that changed from the base of the PR and between 13312b4 and 0457f9a.

📒 Files selected for processing (15)
  • .github/workflows/integration-smoke.yml
  • docker/Dockerfile.weblate-plugin
  • docker/README.md
  • docker/docker-compose.yml
  • pyproject.toml
  • scripts/README.md
  • scripts/integration-smoke.sh
  • scripts/lib/compose.sh
  • scripts/lib/weblate-stack.sh
  • tests/integration/__init__.py
  • tests/integration/conftest.py
  • tests/integration/lib/__init__.py
  • tests/integration/lib/docker_exec.py
  • tests/integration/lib/http.py
  • tests/integration/test_smoke.py

Comment thread .github/workflows/integration-smoke.yml Outdated
Comment thread docker/docker-compose.yml
Comment thread docker/Dockerfile.weblate-plugin
Comment thread scripts/integration-smoke.sh
@whisper67265
Copy link
Copy Markdown
Collaborator Author

@CodeRabbit, resume

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 27, 2026

@whisper67265 Resuming reviews for this PR.

✅ Actions performed

Reviews resumed.

@whisper67265
Copy link
Copy Markdown
Collaborator Author

@CodeRabbit, resume

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 27, 2026

@whisper67265 Resuming reviews for this PR.

✅ Actions performed

Reviews resumed.

@whisper67265 whisper67265 requested a review from henry0816191 May 27, 2026 04:24
@henry0816191 henry0816191 requested a review from wpak-ai May 27, 2026 16:13
@wpak-ai wpak-ai merged commit 8ca9cdf into cppalliance:develop May 27, 2026
6 checks passed
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.

Boost endpoint URL registration QuickBook format registration Container boot + plugin load integration-smoke.yml (compose + install)

3 participants