Skip to content

test: UserRepositoryTest flaky 실패 수정 (정렬 없는 페이지 조회) - #228

Merged
kangcheolung merged 1 commit into
developfrom
fix/user-repository-test-sort
Aug 17, 2026
Merged

test: UserRepositoryTest flaky 실패 수정 (정렬 없는 페이지 조회)#228
kangcheolung merged 1 commit into
developfrom
fix/user-repository-test-sort

Conversation

@kangcheolung

Copy link
Copy Markdown
Member

Summary

#226 작업 검증 중(필터 없는 전체 테스트 실행) 발견한 flaky 테스트를 수정합니다.

UserRepositoryTest.findAdminUsers_*PageRequest.of(0, 20)으로 페이지를 조회하는데 정렬(Sort) 기준이 없었습니다. docgrid_test 스키마는 여러 @SpringBootTest 통합 테스트가 커밋한 row가 정리되지 않고 계속 쌓이는 구조라(별도 이슈 후보), row가 20개를 넘어가면 "1페이지 20개"가 어떤 20개인지 PostgreSQL이 보장해주지 않습니다. 그래서 테스트가 방금 만든 row가 그 안에 포함되는지 매번 운에 달려 있었습니다.

Changes

  • id 내림차순 정렬(Sort.by(Sort.Direction.DESC, "id"))을 명시해서, 방금 생성한(=가장 큰 id) row가 항상 1페이지에 포함되도록 고정했습니다.

Test plan

  • ./backend/gradlew -p backend test --tests "...UserRepositoryTest" 단독 실행 통과
  • 스키마에 30개 row를 추가로 넣어 오염 상황을 재현한 뒤(총 32개) 재실행 → 통과 확인 (수정 전이었다면 실패했을 상황)
  • 재현용으로 넣었던 row는 다시 정리함
  • ./backend/gradlew -p backend test --tests "com.opensource.docgrid.domain.user.*" --tests "com.opensource.docgrid.domain.auth.*" 전체 통과

🤖 Generated with Claude Code

findAdminUsers 호출 시 PageRequest.of(0, 20)에 정렬 기준이 없어서,
docgrid_test 스키마에 다른 테스트가 남긴 row가 쌓이면 방금 만든 row가
1페이지 20개 안에 든다는 보장이 없었다. id 내림차순 정렬을 명시해
방금 만든(가장 큰 id) row가 항상 1페이지에 포함되도록 고정했다.
32개 row가 쌓인 상태로 재현 테스트해서 정상 통과를 확인했다.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@kangcheolung
kangcheolung merged commit a91770c into develop Aug 17, 2026
@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@kangcheolung, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 13 minutes

Limit details: You’ve used all 1 included review currently available under your plan.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 060023ae-065e-4b96-adec-0b79c6d01952

📥 Commits

Reviewing files that changed from the base of the PR and between df7f9e5 and 0b93f3a.

📒 Files selected for processing (1)
  • backend/src/test/java/com/opensource/docgrid/domain/user/repository/UserRepositoryTest.java

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.

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