Skip to content

test: mock Confluence API in CI instead of live instance - #11

Merged
nmoinvaz merged 1 commit into
mainfrom
test/mock-confluence-server
Jul 24, 2026
Merged

test: mock Confluence API in CI instead of live instance#11
nmoinvaz merged 1 commit into
mainfrom
test/mock-confluence-server

Conversation

@nmoinvaz

@nmoinvaz nmoinvaz commented Jul 24, 2026

Copy link
Copy Markdown

The Test workflow ran the whole action against a real Confluence space on solidstatenetworks.jira.com using repo secrets. It started failing when that space was removed, returning 404 No space found with key at the Get Space ID step, unrelated to any code change.

This adds an in-memory mock Confluence server (test/mock_confluence_server.py) covering the four endpoints the action calls, mirroring the mock pattern already used in jira-version-action. The workflow starts it on localhost and runs the action with fake credentials, so the test no longer depends on live infrastructure or secrets.

The action hardcoded https:// in its curl URLs, so action.yml now normalizes the host: a bare hostname still defaults to https, but a host that includes a scheme is left as-is, letting the workflow target http://localhost:8080.

Summary by CodeRabbit

  • New Features

    • Confluence host settings now support full URLs, including custom schemes.
    • Bare hostnames automatically use HTTPS by default.
    • All Confluence operations consistently use the configured host format.
  • Bug Fixes

    • Improved compatibility when connecting to Confluence instances with non-default URL schemes.
  • Tests

    • Added local end-to-end testing with a mock Confluence service, reducing reliance on external environments and credentials.

The Test workflow ran the action against a real Confluence space, so it
failed whenever that space or its secrets changed. Add an in-memory mock
Confluence server and point the workflow at it with fake credentials so
the test is hermetic. Allow the host input to carry a scheme so it can
target the local mock while bare hostnames still default to https.

Assisted-By: Claude Opus 4.8
@nmoinvaz
nmoinvaz requested a review from steve-tucker July 24, 2026 18:02
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The action now accepts scheme-aware Confluence hosts and routes all API calls through a normalized base URL. The test workflow starts a configurable local mock server and runs the action against it using fixed test values.

Changes

Confluence local testing

Layer / File(s) Summary
Mock Confluence API
test/mock_confluence_server.py
Adds a configurable in-memory server supporting space lookup, page retrieval, and page updates.
Host normalization and API URL wiring
action.yml
Normalizes bare hosts to HTTPS URLs and applies the result to all Confluence REST calls.
Workflow mock-server integration
.github/workflows/test.yaml
Starts the mock server, waits for availability, and runs the action with local test inputs.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant TestWorkflow
  participant MockConfluence
  participant Action
  TestWorkflow->>MockConfluence: Start server on port 8080
  TestWorkflow->>MockConfluence: Poll space endpoint
  MockConfluence-->>TestWorkflow: Return availability response
  TestWorkflow->>Action: Run with localhost host and test identifiers
  Action->>MockConfluence: Call normalized Confluence REST URLs
  MockConfluence-->>Action: Return and update page data
Loading

Suggested reviewers: steve-tucker

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main CI change: using a mock Confluence API instead of a live instance.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/mock-confluence-server

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@action.yml`:
- Around line 54-59: Update the host normalization block in the action script to
pass inputs.host through the step environment rather than interpolating it into
shell code, reject carriage returns and newlines before processing, and use
printf when writing confluenceBaseUrl to GITHUB_ENV. Preserve the existing
http/https detection and default https:// prefix behavior.
🪄 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: 9d6fd2e5-5e95-471c-8a06-27fa3f4a8655

📥 Commits

Reviewing files that changed from the base of the PR and between a0a5bff and e12e464.

📒 Files selected for processing (3)
  • .github/workflows/test.yaml
  • action.yml
  • test/mock_confluence_server.py

Comment thread action.yml
@nmoinvaz nmoinvaz added continuous integration Continuous integration changes unit tests Testing framework labels Jul 24, 2026
@nmoinvaz
nmoinvaz force-pushed the test/mock-confluence-server branch from 34cd5ac to e12e464 Compare July 24, 2026 18:25
@nmoinvaz
nmoinvaz enabled auto-merge (rebase) July 24, 2026 18:28
@nmoinvaz
nmoinvaz merged commit 7591842 into main Jul 24, 2026
3 checks passed
@nmoinvaz
nmoinvaz deleted the test/mock-confluence-server branch July 24, 2026 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

continuous integration Continuous integration changes unit tests Testing framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants