[Fix] 결제 동시 승인 테스트 안정화#108
Conversation
- 동일 결제 승인 동시 요청 테스트의 비결정적인 성공/실패 개수 검증 제거 - 이미 완료된 동일 paymentKey 요청이 기존 결과를 반환할 수 있는 현재 정책을 반영 - 실패 응답이 발생하는 경우 PAYMENT_ALREADY_PROCESSED 예외인지 검증 - 크레딧 충전과 충전 거래 내역이 한 번만 생성되는 핵심 보장 조건 유지 - 전체 테스트 통과 확인
📝 WalkthroughWalkthrough
ChangesIngest Compensation on Mock-Apply Failure
Payment Concurrency Test Hardening
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/java/com/jobdri/jobdri_api/domain/jobposting/service/JobPostingExtensionIngestService.java (1)
32-34: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winPreserve the original failure if compensation also throws.
If
deleteJobPosting(...)fails here, it replaces the originalcreateMockApplyFromJobPosting(...)exception, so the caller loses the actual root cause.Suggested change
try { mockApply = mockApplyService.createMockApplyFromJobPosting(user, jobPostingId); } catch (RuntimeException e) { - jobPostingService.deleteJobPosting(user, jobPostingId); + try { + jobPostingService.deleteJobPosting(user, jobPostingId); + } catch (RuntimeException compensationFailure) { + e.addSuppressed(compensationFailure); + } throw e; }🤖 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 `@src/main/java/com/jobdri/jobdri_api/domain/jobposting/service/JobPostingExtensionIngestService.java` around lines 32 - 34, The catch block in JobPostingExtensionIngestService currently lets deleteJobPosting(...) overwrite the original createMockApplyFromJobPosting(...) failure if compensation also throws. Update the RuntimeException handler in that flow to preserve the original exception as the primary cause, and treat any deleteJobPosting failure as secondary so the caller still receives the root cause; use the JobPostingExtensionIngestService method and jobPostingService.deleteJobPosting as the key points to adjust.
🤖 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
`@src/main/java/com/jobdri/jobdri_api/domain/jobposting/service/JobPostingExtensionIngestService.java`:
- Around line 32-34: The catch block in JobPostingExtensionIngestService
currently lets deleteJobPosting(...) overwrite the original
createMockApplyFromJobPosting(...) failure if compensation also throws. Update
the RuntimeException handler in that flow to preserve the original exception as
the primary cause, and treat any deleteJobPosting failure as secondary so the
caller still receives the root cause; use the JobPostingExtensionIngestService
method and jobPostingService.deleteJobPosting as the key points to adjust.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 87358fbc-c75d-4af6-811b-b35021659ec9
📒 Files selected for processing (3)
src/main/java/com/jobdri/jobdri_api/domain/jobposting/service/JobPostingExtensionIngestService.javasrc/test/java/com/jobdri/jobdri_api/domain/jobposting/service/JobPostingExtensionIngestServiceTest.javasrc/test/java/com/jobdri/jobdri_api/domain/payment/service/PaymentServiceTest.java
✨ 어떤 이유로 PR를 하셨나요?
📋 세부 내용 - 왜 해당 PR이 필요한지 작업 내용을 자세하게 설명해주세요
📸 작업 화면 스크린샷
🚨 관련 이슈 번호 [ ]
Summary by CodeRabbit
Bug Fixes
Tests