Skip to content

test: add acceptance tests for rr get - #66

Merged
roxblnfk merged 4 commits into
2.xfrom
test/acceptance
Oct 9, 2026
Merged

roxblnfk merged 4 commits into
2.xfrom
test/acceptance

Conversation

@roxblnfk

@roxblnfk roxblnfk commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

What was changed

  • New Acceptance Testo suite: black-box tests that run bin/rr get as a separate process in a temporary directory with a clean environment, against a fake GitHub API (tests/Acceptance/Server/router.php under php -S) reached through RR_GITHUB_API_URL.
  • Checks are made on the exit code, the installed binary (each fake archive carries a fake rr <version> <os> <arch> marker), .rr.yaml and the request log; console text is only matched loosely.
  • Covered: default version, --filter, --stability, other OS/arch (rr.exe from a zip, darwin tar.gz), fallback past a release without the assembly (.deb/protoc assets ignored), unknown versions, --no-config/-p/--preset, existing .rr.yaml and binary, interactive answers, 403 rate limit, 404 asset, unreachable API, pagination, request budget, get/get-binary.
  • New Acceptance Tests workflow runs the suite on Ubuntu and Windows (PHP 8.2 and 8.5); the testo workflow and Infection run only the Unit suite.
  • A Live suite downloads real binaries from GitHub; it is registered only with RR_CLI_LIVE_TESTS=1 and runs on workflow_dispatch only.

Review notes

Checklist

  • Tested
    • Acceptance tests added, green on Ubuntu and Windows in CI
    • Live suite run locally against the real GitHub

Releases can be fetched from GitHub Enterprise, a mirror or a mock server. The variable is not `GITHUB_API_URL` because GitHub Actions sets that one in every job. Releases are requested 100 per page, so listing them takes 2 requests instead of about 7.

Assisted-By: Claude Opus 5.5
@roxblnfk
roxblnfk requested a review from a team October 9, 2026 22:20
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e120a17d-eaf4-4eec-bafc-8961bf05a8ca

📥 Commits

Reviewing files that changed from the base of the PR and between d8a5b3f and 0e4c78a.


📒 Files selected for processing (21)
  • .github/workflows/acceptance.yml
  • .github/workflows/testo.yml
  • README.md
  • infection.json5
  • src/Command.php
  • src/Repository/GitHub/GitHubRepository.php
  • testo.php
  • tests/Acceptance/ConfigurationTest.php
  • tests/Acceptance/ExistingBinaryTest.php
  • tests/Acceptance/FailureTest.php
  • tests/Acceptance/Server/releases.json
  • tests/Acceptance/Server/router.php
  • tests/Acceptance/Support/FakeGitHub.php
  • tests/Acceptance/Support/FakeGitHubCase.php
  • tests/Acceptance/Support/Result.php
  • tests/Acceptance/Support/Rr.php
  • tests/Acceptance/Support/Workdir.php
  • tests/Acceptance/VersionSelectionTest.php
  • tests/Live/GitHubTest.php
  • tests/Unit/CommandTest.php
  • tests/Unit/Repository/GitHub/GitHubRepositoryTest.php

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.



📝 Walkthrough

Walkthrough

The CLI can use a configurable GitHub releases API endpoint. The change adds acceptance tests for rr get, a live GitHub test suite, and workflows that run the test suites.

Changes

GitHub API and rr get test coverage

Layer / File(s) Summary
Configurable GitHub API URL
src/Command.php, src/Repository/GitHub/GitHubRepository.php, README.md, tests/Unit/...
RR_GITHUB_API_URL now selects the releases API base URL; the default remains https://api.github.com. Release requests use per_page=100. Unit tests cover custom URLs and pagination.
Acceptance test harness
tests/Acceptance/Server/*, tests/Acceptance/Support/*
A local fake GitHub server serves release and download responses and records requests. Helpers run the CLI in temporary work directories and capture its results.
Acceptance coverage for rr get
tests/Acceptance/ConfigurationTest.php, tests/Acceptance/ExistingBinaryTest.php, tests/Acceptance/FailureTest.php, tests/Acceptance/VersionSelectionTest.php
Acceptance tests cover configuration, overwrite prompts, release selection, platform downloads, pagination, and failure cases.
Test suite registration and workflows
testo.php, .github/workflows/acceptance.yml, .github/workflows/testo.yml, infection.json5, tests/Live/GitHubTest.php
Unit and Acceptance suites are configured by default. Live tests are added when RR_CLI_LIVE_TESTS is true. Workflows run acceptance tests and provide a manual live-test job.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Other

Suggested reviewers: butschster


Merge Risk: ⚪ Minimal · up to 0e4c7

The acceptance workflow has no identified blocker and is ready to merge after normal checks.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 17.14% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 70 functions across 16 files. (5 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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 identifies the main change: adding acceptance tests for the rr get command. It is concise and related to the pull request objectives.

Full details: Docstring Coverage

Explanation

Docstring coverage is 17.14% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 70 functions across 16 files. (5 skipped: 5 unsupported.)



  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR

🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

The tests run `bin/rr` as a separate process against a fake GitHub API served by `php -S`, reached through RR_GITHUB_API_URL, and check the exit code, the installed binary, `.rr.yaml` and the requests made. They run on Linux and Windows in their own workflow and are kept out of Infection, since mutants in a child process are never covered. A live suite against the real GitHub runs only on manual dispatch.

Six cases that expose bugs are skipped with the reason: RC tags sort below beta ones, an unknown --os/--arch still fetches the releases, and a kept binary still exits with 0.

Assisted-By: Claude Opus 5.5
@roxblnfk
roxblnfk merged commit 5969687 into 2.x Oct 9, 2026
15 checks passed
@roxblnfk
roxblnfk deleted the test/acceptance branch October 9, 2026 22:35
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.

1 participant