[TEST] Testcontainers 기반 CI 테스트 환경 구성#9
Conversation
|
Warning Rate limit exceeded
To continue reviewing without waiting, purchase usage credits in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughTestcontainers를 이용한 통합 테스트 인프라를 구축합니다. PostgreSQL과 Redis 컨테이너를 자동으로 시작하는 추상 기본 테스트 클래스를 추가하고, 기존 테스트 클래스들을 이를 상속하도록 리팩토링했습니다. CI 워크플로우는 테스트 실행 단계를 분리했습니다. ChangesTest Infrastructure Setup with Testcontainers
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the 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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/test/java/com/example/auctionnotification/testutils/BaseIntegrationTest.java (1)
11-17: ⚡ Quick win컨테이너 필드를
final로 선언하세요
postgres와redis필드가static이지만final로 선언되지 않아, 하위 클래스에서 재할당이 가능합니다. 정적 초기화 블록에서 시작되는 공유 컨테이너는 불변으로 선언하는 것이 안전합니다.🛡️ 제안 수정
- static PostgreSQLContainer<?> postgres = new PostgreSQLContainer<>( + static final PostgreSQLContainer<?> postgres = new PostgreSQLContainer<>( DockerImageName.parse("postgres:16-alpine") ); - static GenericContainer<?> redis = new GenericContainer<>( + static final GenericContainer<?> redis = new GenericContainer<>( DockerImageName.parse("redis:7-alpine") ).withExposedPorts(6379);🤖 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/test/java/com/example/auctionnotification/testutils/BaseIntegrationTest.java` around lines 11 - 17, Make the shared container fields immutable by declaring the static fields `postgres` and `redis` in `BaseIntegrationTest` as `static final`; update their declarations so they are initialized once (as they already are) and cannot be reassigned by subclasses, e.g., change `static PostgreSQLContainer<?> postgres = ...` and `static GenericContainer<?> redis = ...` to `static final PostgreSQLContainer<?> postgres = ...` and `static final GenericContainer<?> redis = ...`.
🤖 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.
Inline comments:
In `@src/main/resources/application-test.yml`:
- Around line 1-12: application-test.yml is currently under src/main/resources
and will be packaged into production JAR exposing test secrets and test DB
settings; move the file to src/test/resources so it is only on the test
classpath, and verify the test YAML entries (jwt.secret.key and
spring.jpa.hibernate.ddl-auto) remain identical after the move; update any
build/test configs if they reference the old path.
---
Nitpick comments:
In
`@src/test/java/com/example/auctionnotification/testutils/BaseIntegrationTest.java`:
- Around line 11-17: Make the shared container fields immutable by declaring the
static fields `postgres` and `redis` in `BaseIntegrationTest` as `static final`;
update their declarations so they are initialized once (as they already are) and
cannot be reassigned by subclasses, e.g., change `static PostgreSQLContainer<?>
postgres = ...` and `static GenericContainer<?> redis = ...` to `static final
PostgreSQLContainer<?> postgres = ...` and `static final GenericContainer<?>
redis = ...`.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: b5c9c54b-6c77-4bdd-8b8f-331d7f311dd8
📒 Files selected for processing (7)
.github/workflows/ci.yml.gitignorebuild.gradlesrc/main/resources/application-test.ymlsrc/test/java/com/example/auctionnotification/AuctionNotificationApplicationTests.javasrc/test/java/com/example/auctionnotification/notification/NotificationIntegrationTest.javasrc/test/java/com/example/auctionnotification/testutils/BaseIntegrationTest.java
💤 Files with no reviewable changes (1)
- .gitignore
📝 작업 내용
🔗 관련 이슈 (Related Issues)
Closes #
✅ 체크리스트 (Checklist)
💬 기타 사항
Summary by CodeRabbit
테스트
빌드
Chores