Skip to content

plugin test reliability and stabilization#95

Merged
wpak-ai merged 1 commit into
cppalliance:developfrom
whisper67265:feature/plugin-test-enhancement
Jun 4, 2026
Merged

plugin test reliability and stabilization#95
wpak-ai merged 1 commit into
cppalliance:developfrom
whisper67265:feature/plugin-test-enhancement

Conversation

@whisper67265
Copy link
Copy Markdown
Collaborator

@whisper67265 whisper67265 commented Jun 4, 2026

Close #84, close #85.

Summary by CodeRabbit

  • Documentation

    • Expanded plugin integration docs with test variants, timeout defaults, required env vars, local reproduction steps, and guidance to skip slow tests.
  • Tests

    • Marked long-running plugin tests as slow and added per-test timeout limits; introduced configurable pytest options and rerun behavior.
  • Chores

    • Improved CI/test startup: stricter health checks, API readiness polling, longer/adjustable timeouts, and retrying token acquisition.
  • Dependencies

    • Added a test helper dependency to support reruns.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 4, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9ce47455-6ce4-46db-90d3-7b400a48ada1

📥 Commits

Reviewing files that changed from the base of the PR and between d3531c4 and 0e702da.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (13)
  • .github/README.md
  • .github/workflows/ci-plugin-auth.yml
  • .github/workflows/ci-plugin-functional.yml
  • .github/workflows/ci-plugin-smoke.yml
  • pyproject.toml
  • scripts/README.md
  • scripts/lib/weblate-stack.sh
  • scripts/plugin-auth.sh
  • scripts/plugin-functional.sh
  • scripts/plugin-smoke.sh
  • tests/plugin/conftest.py
  • tests/plugin/test_functional.py
  • tests/plugin/test_rate_limit.py

📝 Walkthrough

Walkthrough

Wires CI and local scripts to new Weblate stack helpers (compose --wait, API ping, token retry), exposes HEALTH_TIMEOUT and PYTEST_PLUGIN_OPTS, adds pytest-rerunfailures and a slow marker, marks slow tests with per-test timeouts, and enforces a deterministic functional-test class order.

Changes

Plugin Test Resilience Configuration

Layer / File(s) Summary
Test infrastructure: dependencies and markers
pyproject.toml
Adds pytest-rerunfailures==16.3 to plugin test deps and declares a slow pytest marker.
Weblate stack helper functions
scripts/lib/weblate-stack.sh
stack_up uses compose up -d --wait; default stack_wait_healthy() timeout adjusted; adds stack_wait_api_ready() to poll Boost ping and stack_create_token_retry() to retry token creation.
CI workflows, docs, and test entrypoint scripts
.github/README.md, .github/workflows/ci-plugin-auth.yml, .github/workflows/ci-plugin-functional.yml, .github/workflows/ci-plugin-smoke.yml, scripts/README.md, scripts/plugin-auth.sh, scripts/plugin-functional.sh, scripts/plugin-smoke.sh
CI steps now set HEALTH_TIMEOUT (auth/smoke=240s, functional=300s); docs updated with job limits and local commands; entrypoint scripts use new helpers, switch to stack_create_token_retry, and expose PYTEST_PLUGIN_OPTS passed into pytest.
Test markers, timeouts, ordering, and cleanup handling
tests/plugin/conftest.py, tests/plugin/test_functional.py, tests/plugin/test_rate_limit.py
Adds _FUNCTIONAL_CLASS_ORDER and pytest_collection_modifyitems() to enforce functional class order; marks several functional and rate-limit tests as @pytest.mark.slow and decorates tests with per-test @pytest.mark.timeout(); fixture cleanup now surfaces and logs delete errors.

Sequence Diagram

sequenceDiagram
  participant CI as CI Workflow
  participant Script as Test Script
  participant StackHelper as Weblate Stack Helper
  participant Pytest as Pytest
  CI->>Script: set HEALTH_TIMEOUT env var
  Script->>StackHelper: call stack_up() / stack_wait_healthy(HEALTH_TIMEOUT)
  StackHelper->>StackHelper: wait for docker compose healthchecks
  Script->>StackHelper: call stack_wait_api_ready()
  StackHelper->>StackHelper: poll /boost-endpoint/plugin-ping/
  Script->>StackHelper: call stack_create_token_retry(admin)
  StackHelper->>StackHelper: retry token creation until non-empty
  Script->>Pytest: set PYTEST_PLUGIN_OPTS and invoke pytest with --override-ini addopts
  Pytest->>Pytest: run tests with timeouts/reruns and collection ordering
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • henry0816191
  • wpak-ai

Poem

🐰 Hopping through tests with a retrying heart,

I wait till the API answers its part.
Timeouts set gentle, slow tests take stage,
Tokens retried kindly to calm flakiness' rage.
Cheers — the CI blooms with a steadier page.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.83% 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 pull request title "plugin test reliability and stabilization" accurately reflects the main objective of improving test stability and reliability across all plugin test workflows.
Linked Issues check ✅ Passed The pull request comprehensively addresses all four acceptance criteria from issue #84: compose up now waits for healthchecks, configurable HEALTH_TIMEOUT values are wired through CI and entrypoint scripts, API token creation uses retry logic, functional tests are deterministically ordered, and slow tests are marked and documented.
Out of Scope Changes check ✅ Passed All changes are directly aligned with issue #84 requirements: adding HEALTH_TIMEOUT env vars, implementing retry helpers, configuring pytest markers, and documenting plugin integration jobs. No unrelated modifications detected.

✏️ 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.

🧹 Nitpick comments (1)
scripts/lib/weblate-stack.sh (1)

49-50: ⚡ Quick win

Make API readiness polling tunable via env defaults.

Line 49 and Line 50 are only configurable through positional args today. Adding env fallbacks makes CI/local tuning possible without touching callers, which helps stabilize slow runners.

♻️ Proposed change
 stack_wait_api_ready() {
     local port="${WEBLATE_PORT:-8080}"
     local url="http://localhost:${port}/boost-endpoint/plugin-ping/"
-    local attempts="${1:-12}"
-    local interval="${2:-5}"
+    local attempts="${1:-${API_READY_ATTEMPTS:-12}}"
+    local interval="${2:-${API_READY_INTERVAL:-5}}"
     local i=0
🤖 Prompt for 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.

In `@scripts/lib/weblate-stack.sh` around lines 49 - 50, The script currently sets
local variables attempts and interval only from positional args (local
attempts="${1:-12}" and local interval="${2:-5}"), making CI tuning awkward;
change these to prefer positional args, then environment variables, then
defaults (e.g., attempts = first param || $ATTEMPTS || 12, interval = second
param || $INTERVAL || 5) so callers remain compatible while allowing env-based
overrides for CI/local tuning; update the variable assignments in
scripts/lib/weblate-stack.sh accordingly.
🤖 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.

Nitpick comments:
In `@scripts/lib/weblate-stack.sh`:
- Around line 49-50: The script currently sets local variables attempts and
interval only from positional args (local attempts="${1:-12}" and local
interval="${2:-5}"), making CI tuning awkward; change these to prefer positional
args, then environment variables, then defaults (e.g., attempts = first param ||
$ATTEMPTS || 12, interval = second param || $INTERVAL || 5) so callers remain
compatible while allowing env-based overrides for CI/local tuning; update the
variable assignments in scripts/lib/weblate-stack.sh accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3447f129-ea91-409a-b7dd-25df88a33803

📥 Commits

Reviewing files that changed from the base of the PR and between d3531c4 and 0e702da.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (13)
  • .github/README.md
  • .github/workflows/ci-plugin-auth.yml
  • .github/workflows/ci-plugin-functional.yml
  • .github/workflows/ci-plugin-smoke.yml
  • pyproject.toml
  • scripts/README.md
  • scripts/lib/weblate-stack.sh
  • scripts/plugin-auth.sh
  • scripts/plugin-functional.sh
  • scripts/plugin-smoke.sh
  • tests/plugin/conftest.py
  • tests/plugin/test_functional.py
  • tests/plugin/test_rate_limit.py

@whisper67265
Copy link
Copy Markdown
Collaborator Author

@coderabbitai, resume.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 4, 2026

@whisper67265: Resuming automated reviews for this PR.

✅ Action performed

Reviews resumed.

@whisper67265
Copy link
Copy Markdown
Collaborator Author

@coderabbitai, full review again.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 4, 2026

@whisper67265: Sure! Kicking off a full review of the PR now.

✅ Action performed

Full review finished.

@whisper67265
Copy link
Copy Markdown
Collaborator Author

@coderabbitai, resume

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 4, 2026

@whisper67265: Resuming automated reviews for this PR.

✅ Action performed

Reviews resumed.

@whisper67265 whisper67265 requested a review from henry0816191 June 4, 2026 16:04
@henry0816191 henry0816191 requested a review from wpak-ai June 4, 2026 18:09
@wpak-ai wpak-ai merged commit 618d781 into cppalliance:develop Jun 4, 2026
9 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.

Plugin test reliability: pytest-timeout Plugin test stabilization

3 participants