test(smartlog): Phase 4 #310 — PARSEC_GITHUB_API_BASE + mockito overlay integration tests - #421
Merged
Merged
Conversation
…ay integration tests Add PARSEC_GITHUB_API_BASE env var override so tests (and GitHub Enterprise users) can route GitHubClient calls to a custom API endpoint without changing the git remote URL. Also adds two CLI-level integration tests that close the 'mock 으로 통합 테스트' gap in issues #309 and #310. ## Changes ### src/env.rs - PARSEC_GITHUB_API_BASE constant + github_api_base() function (mirrors existing PARSEC_BITBUCKET_API_BASE pattern) ### src/github/mod.rs - GitHubClient::new() uses github_api_base() override when set (single-line additive change; falls back to remote.api_base() when unset) ### tests/cli_tests.rs - test_smartlog_no_overlay_skips_github: verifies --no-overlay exits 0 without any GitHub token and emits no PR/CI badges - test_smartlog_overlay_with_mock_github: spins up a mockito server, points PARSEC_GITHUB_API_BASE at it, runs parsec smartlog, and asserts that [PR #99] and [CI: ✓ passed] badges appear in ASCII output Refs #309 (통합 테스트 acceptance criterion) Refs #310 (mock 으로 통합 테스트 acceptance criterion) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
무엇
PARSEC_GITHUB_API_BASE환경 변수를 추가해 테스트(및 GitHub Enterprise 사용자)가 git remote URL을 바꾸지 않고도 GitHub API 호출을 임의 엔드포인트로 라우팅할 수 있도록 합니다. 이를 기반으로 두 개의 CLI-level 통합 테스트를 추가해 issues #309 및 #310의mock 으로 통합 테스트 1개 이상수락 기준을 충족합니다.왜
Refs #309 (PR overlay — '통합 테스트 (mock)' acceptance criterion)
Refs #310 (CI overlay — 'mock 으로 통합 테스트 1개 이상' acceptance criterion)
Milestone: v1.0
PARSEC_GITHUB_API_BASE추가로 subprocess가 mockito 서버를 바라보게 할 수 있음 (PARSEC_BITBUCKET_API_BASE 패턴과 동일)변경
src/env.rsPARSEC_GITHUB_API_BASE상수 +github_api_base()함수 추가(
PARSEC_BITBUCKET_API_BASE기존 패턴 동일하게 적용)src/github/mod.rsGitHubClient::new()에서 env 오버라이드가 있으면 사용, 없으면remote.api_base()fallbacktests/cli_tests.rstest_smartlog_no_overlay_skips_github:--no-overlay시 GITHUB_TOKEN 없이도 exit 0, PR/CI 배지 없음 확인test_smartlog_overlay_with_mock_github: mockito 서버 기동 → git remote URL을 GitHub 스타일로 전환 →PARSEC_GITHUB_API_BASE주입 → 5개 엔드포인트 mock →parsec smartlog→[PR #99]+[CI: ✓ passed]배지 확인다음 Phase 힌트
Phase 5 후보:
리스크
low — 기존 prod 경로 변경 없음. env 오버라이드 미설정 시 기존
remote.api_base()그대로 사용. 테스트 전용 변경.롤백
git revert 8394c79— 3개 파일, 핵심 로직 불변Test plan
cargo build --quiet✅cargo fmt --check✅cargo clippy --all-targets -- -D warnings✅cargo test --quiet: 330 tests pass ✅ (83 CLI tests including 2 new overlay integration tests)@erishforG