test: CourseController @WebMvcTest 파일럿 추가 + JPA Auditing 설정 분리 - #226
Merged
Conversation
서비스 레이어 단위 테스트에 이어 컨트롤러 레이어(라우팅/@Valid/@userid 인증/예외→HTTP 매핑) 검증을 위해 @WebMvcTest 슬라이스 테스트를 시작한다. 도입 과정에서 @EnableJpaAuditing이 ServerApplication(루트 설정 클래스)에 붙어있으면 슬라이스 테스트가 엔티티 없이도 JpaMetamodelMappingContext를 만들려다 "JPA metamodel must not be empty" 로 컨텍스트 로딩에 실패하는 문제를 발견해, 별도 JpaAuditingConfig로 분리했다.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughThe change moves JPA auditing to a dedicated configuration class and adds ChangesJPA auditing configuration
Course controller tests
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
2 tasks
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.
작업 배경
변경 사항
ServerApplication.java@EnableJpaAuditing을 제거config/jpa/JpaAuditingConfig.java(신규)@EnableJpaAuditing을 별도@Configuration클래스로 분리course/controller/CourseControllerTest.java(신규)영향 범위
@EnableJpaAuditing이 루트@SpringBootApplication클래스에 있으면,@WebMvcTest가 엔티티를 전혀 스캔하지 않는 상태에서도 JPA Auditing 인프라(jpaMappingContext)를 억지로 초기화하려다JPA metamodel must not be empty!로 컨텍스트 로딩 자체가 실패하는 문제가 있었음. 별도@Configuration클래스로 분리하면 슬라이스 테스트의 컴포넌트 스캔 필터에서 제외되어 문제가 해결됨.ServerApplicationTests.contextLoads()포함 전체 196개 테스트 로컬 DB/Redis 기동 후 통과 확인.검증 매트릭스
정상_생성인증헤더_없음유효성검증_실패정상_조회존재하지_않는_코스정상_수정빈_제목정상_삭제Test Plan
./gradlew test --tests "...CourseControllerTest"8/8 통과./gradlew test전체 196/196 통과 (ServerApplicationTests.contextLoads() 포함)🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests