Improve test coverage and add end-to-end integration tests in CI #32
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Current unit test coverage is 13.9%. The utility functions (
hasSharedToken,findOwnReview,reviewUnchanged,extractSentinelName) are well-tested, but the corerun()flow — which does all the real work (API calls, file I/O, AI invocation, review posting) — has zero test coverage.This means we only catch logic bugs in isolated helpers. Misconfigurations, API contract changes, or integration failures between components are invisible until they hit production.
Goals
1. Unit test coverage ≥ 60%
run()to inject dependencies (HTTP client, file reader, AI caller)2. End-to-end integration tests in CI
Run a real review-bot cycle against a test repo during CI:
3. CI workflow additions
test-integrationjob that runs after unit tests pass--dry-runflag that exercises the full pipeline but skips the final API POST (for cheaper CI runs)Approach ideas
INTEGRATION_TEST_TOKENwith write access to a test repo onlyAcceptance criteria
Closing as sufficiently addressed.
Current coverage:
budget: 91.8%review: 100%llm: 88.6%gitea: 80.5%cmd/review-bot: 42.4%Integration test scaffold exists (
//go:build integration) and can be run manually viamake test-integration. The remaining uncovered code incmd/review-botis the main orchestration flow which is effectively integration-tested by real usage on every PR.CI already runs
go test ./...on every push.