-
Notifications
You must be signed in to change notification settings - Fork 1
infra: h2 기반으로 CI 환경 구축 #197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📝 WalkthroughWalkthroughCI 워크플로우에서 Docker/MySQL 시작 단계 제거, 로컬·테스트 Compose를 MySQL→Oracle XE로 교체, 로컬/테스트 프로필을 H2 인메모리 DB로 전환, 스키마 타입을 TIMESTAMP/NUMBER(1)/VARCHAR 등으로 변경, 일부 MySQL 전용 테스트 비활성화, Generation 조회 로직을 서비스로 이동. Changes
Sequence Diagram(s)sequenceDiagram
rect rgba(200,100,100,0.5)
participant Manager as GenerationActiveStateManager
end
rect rgba(100,200,100,0.5)
participant Finder as GenerationFindService
end
rect rgba(100,100,200,0.5)
participant Repo as GenerationRepository/DB
end
Manager->>Finder: existsActiveGeneration()
Finder->>Repo: 쿼리 (limit 1, is_active = true)
Repo-->>Finder: 결과 (있음/없음)
Finder-->>Manager: Boolean
alt 활성 generation 존재
Manager->>Finder: findAllActiveGeneration()
Finder->>Repo: 쿼리 (is_active = true)
Repo-->>Finder: List<GenerationEntity>
Finder-->>Manager: List<GenerationEntity>
Manager->>Repo: deactivate target generation(s) (via repository)
Repo-->>Manager: 변경 결과
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧹 Recent nitpick comments
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (7)
🚧 Files skipped from review as they are similar to previous changes (4)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (7)
✏️ Tip: You can disable this entire section by setting 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (4)
src/test/kotlin/co/yappuworld/user/client/application/usecase/SignUpExecutorConcurrencyTest.kt (1)
68-92: ExecutorService 종료 누락 (현재 비활성화 상태이므로 영향 없음)테스트가 재활성화될 경우를 대비하여,
ExecutorService는 사용 후 명시적으로 종료해야 합니다.♻️ 향후 재활성화 시 적용할 수정안
latch.await() + executorService.shutdown() userRepository.count() shouldBe 1또는 Kotlin의
use확장 함수를 활용하여AutoCloseable패턴 적용을 고려해보세요.src/main/resources/schema.sql (1)
159-160: BOOLEAN 기본값을FALSE로 변경 권장
BOOLEAN타입에DEFAULT 0대신DEFAULT FALSE를 사용하면 가독성이 향상됩니다.♻️ 제안된 변경
- has_app BOOLEAN NOT NULL DEFAULT 0, - has_web BOOLEAN NOT NULL DEFAULT 0, + has_app BOOLEAN NOT NULL DEFAULT FALSE, + has_web BOOLEAN NOT NULL DEFAULT FALSE,docker/docker-compose-local.yaml (1)
4-20: Oracle XE 로컬 설정은 적절하게 구성됨
start_period: 60s로 Oracle 초기화 시간을 충분히 고려한 점이 좋습니다.다만 명확한 설명이 필요한 부분:
application-local.yaml에서는 H2를 사용하고 Spring docker compose support가 비활성화(enabled: false)되어 있는 반면,docker-compose-local.yaml은 Oracle XE를 구성하고 있습니다. 이 파일이 정확히 언제/어떤 시나리오에서 사용되는지(다른 프로필용인지, 수동 설정용인지 등) 주석이나 README에 문서화하면 좋겠습니다.src/main/resources/application-local.yaml (1)
23-26: H2 로컬 환경에서는 H2Dialect 사용을 권장합니다현재 설정에서
OracleDialect를 사용하고 있으나, 로컬 개발 환경은 H2 데이터베이스(MODE=Oracle)를 사용하고 있습니다. 코드베이스에서@Query로 커스텀 SQL을 사용하거나SEQUENCE생성 전략을 사용하는 부분이 없어 현재는 정상 동작하지만, 더 명확한 의도를 반영하기 위해 로컬 환경의 JPA 설정을 다음과 같이 변경하는 것을 권장합니다:database-platform: org.hibernate.dialect.H2Dialect이렇게 하면 로컬 개발 환경이 실제 데이터베이스(
OracleDialect)와 다르다는 점을 명시적으로 드러낼 수 있습니다. (application-dev.yaml, application-prod.yaml 등 다른 환경에서는 실제 Oracle 설정 사용)
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (9)
.github/workflows/yappu-world-ci.yamlbuild.gradle.ktsdocker/docker-compose-local.yamldocker/docker-compose-test.yamlsrc/main/resources/application-local.yamlsrc/main/resources/application-test.yamlsrc/main/resources/schema.sqlsrc/test/kotlin/co/yappuworld/user/client/application/usecase/SignUpExecutorConcurrencyTest.ktsrc/test/kotlin/co/yappuworld/user/client/application/usecase/SignUpExecutorTest.kt
💤 Files with no reviewable changes (1)
- .github/workflows/yappu-world-ci.yaml
🔇 Additional comments (9)
src/test/kotlin/co/yappuworld/user/client/application/usecase/SignUpExecutorConcurrencyTest.kt (1)
66-66: 테스트 비활성화 이유가 명확하게 문서화되어 좋습니다.MySQL Named Lock이 H2에서 지원되지 않아
xfeature로 비활성화한 것은 적절한 접근입니다. 향후 동시성 테스트를 위한 대안 고려를 권장합니다:
- Testcontainers를 사용하여 실제 MySQL/Oracle 컨테이너로 테스트
- H2 호환 가능한 비관적 락(Pessimistic Lock) 기반 대체 구현 테스트
향후 동시성 테스트 재활성화 계획이 있는지 확인 부탁드립니다.
src/test/kotlin/co/yappuworld/user/client/application/usecase/SignUpExecutorTest.kt (1)
19-42: LGTM!
xfeature를 사용한 테스트 비활성화와 사유 문서화가 일관되게 적용되었습니다. 테스트 코드를 삭제하지 않고 보존하여 향후 MySQL/Oracle 환경에서 재활성화할 수 있도록 한 점이 좋습니다.build.gradle.kts (1)
36-36: LGTM!H2 데이터베이스 의존성이
runtimeOnly로 적절하게 추가되었습니다. Spring Boot BOM이 버전을 관리하므로 버전 미지정이 적절합니다.docker/docker-compose-test.yaml (1)
1-15: docker-compose-test.yaml 사용처 확인 필요
application-test.yaml에서docker.compose.enabled: false로 설정되어 있고 H2 인메모리 DB를 사용합니다. 이 Oracle XE docker-compose 설정이 어디서 사용되는지 확인이 필요합니다.CI 워크플로우에서도 Docker 설정 단계가 제거된 것으로 보이는데, 이 파일이 현재 사용되지 않는다면 삭제를 고려하거나, 사용 목적을 README나 주석으로 문서화해 주세요.
src/main/resources/application-test.yaml (1)
23-26: 테스트 환경에서 환경 변수 설정 확인 필요JWT 관련 설정이 환경 변수(
${DEV_JWT_SECRET_KEY}등)를 참조하고 있습니다. CI 환경에서 이 환경 변수들이 올바르게 설정되어 있는지 확인해 주세요. 누락 시 테스트 실행이 실패할 수 있습니다.src/main/resources/schema.sql (2)
34-34: H2에서 JSON 타입 호환성 확인 필요
json타입이sign_up_application.details와team_services.service_links에서 사용되고 있습니다. H2는 JSON 타입을 지원하지만 Oracle과 동작 방식이 다를 수 있습니다. 테스트 시 JSON 필드 관련 기능이 정상 동작하는지 확인해 주세요.
86-87: LocalTimeStringConverter로 자동 변환되므로 문제없음
time과end_time이 varchar(32)로 저장되지만,LocalTimeStringConverter의@Converter(autoApply = true)설정으로 인해 자동으로LocalTime객체로 변환됩니다. 애플리케이션 레벨에서는LocalTime타입으로 동작하므로 정렬, 비교, 계산이 모두 정상 작동합니다. 의도된 변경이며 JPA 매핑이 올바르게 되어 있습니다.src/main/resources/application-local.yaml (2)
12-15: LGTM - H2 Oracle 모드 설정이 적절합니다.
MODE=Oracle과 함께DATABASE_TO_LOWER=TRUE,NON_KEYWORDS=VALUE옵션이 Oracle 호환성을 위해 잘 구성되어 있습니다.
28-31: H2 콘솔 설정이 적절합니다.로컬 개발 환경에서 H2 콘솔 활성화는 디버깅에 유용하며,
application-prod.yaml과application-prod-oci.yaml에서는 H2 콘솔이 활성화되지 않아 운영 환경의 보안이 보장됩니다.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/main/kotlin/co/yappuworld/operation/client/application/GenerationActiveStateManager.kt (1)
72-75: 문자열 템플릿 내 불필요한 닫는 중괄호Line 74에서
}}가 있는데, 문자열 템플릿 종료}가 하나 더 있습니다. 의도된 것인지 확인해 주세요.logger.error { "활성화 된 기수: ${ activeGenerations.map { it.value }.joinToString(", ") - }}" + }" }
🤖 Fix all issues with AI agents
In
`@src/main/kotlin/co/yappuworld/operation/infrastructure/GenerationFindService.kt`:
- Around line 33-39: Remove the unused repository method
GenerationRepository.findAllByIsActiveIsTrue() from the codebase since
GenerationFindService.findAllActiveGeneration() now provides the JDSL-based
replacement; locate and delete the method declaration in GenerationRepository
(and any related unused imports or interface references) and run a build/IDE
search to ensure no callers remain, leaving the defensive filterNotNull() in
findAllActiveGeneration() as-is.
♻️ Duplicate comments (2)
src/main/resources/application-test.yaml (1)
17-21: H2 데이터베이스에 OracleDialect 사용 시 호환성 문제 가능성H2의
MODE=Oracle은 SQL 문법 수준의 호환성을 제공하지만, Hibernate의OracleDialect는 Oracle 고유 기능(시퀀스 생성 구문, 락 함수, 페이징 쿼리 등)을 생성합니다. H2가 이를 완전히 지원하지 않아 런타임 오류가 발생할 수 있습니다.이전 리뷰에서 지적된
get_lock()/release_lock()함수 문제도 이 호환성 이슈의 일부입니다.권장 수정안
jpa: - database-platform: org.hibernate.dialect.OracleDialect + database-platform: org.hibernate.dialect.H2Dialect hibernate: ddl-auto: none show-sql: trueH2Dialect를 사용하고, H2의 Oracle 모드가 JDBC 레벨에서 Oracle 호환 SQL을 처리하도록 하는 것이 더 안정적입니다. 단, 이 경우에도 Oracle 전용 네이티브 쿼리(락 함수 등)는 별도 처리가 필요합니다.
src/main/resources/schema.sql (1)
162-162: JSON 타입 사용 (team_services)
sign_up_application.details와 마찬가지로service_links컬럼도json타입을 사용합니다. H2 버전 호환성 확인 시 함께 검증해 주세요.
🧹 Nitpick comments (1)
src/main/resources/schema.sql (1)
84-87: 날짜/시간 컬럼에 VARCHAR 사용에 대한 검토
start_date,end_date는varchar(10)으로,start_time,end_time은varchar(32)로 정의되어 있습니다. H2와 Oracle 모두DATE,TIME,TIMESTAMP타입을 지원하므로, 문자열 대신 네이티브 타입 사용을 고려해 보세요.VARCHAR 사용 시 고려사항:
- 데이터베이스 레벨에서 날짜/시간 유효성 검증 불가
- 날짜 비교 연산 시 문자열 정렬 문제 발생 가능
varchar(32)는 시간 표현에 과도하게 큼 (HH:MM:SS는 8자)애플리케이션 레벨에서 의도적으로 문자열 처리를 하는 것이라면 현재 구현도 괜찮습니다.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
src/main/kotlin/co/yappuworld/operation/client/application/GenerationActiveStateManager.ktsrc/main/kotlin/co/yappuworld/operation/infrastructure/GenerationFindService.ktsrc/main/kotlin/co/yappuworld/operation/infrastructure/GenerationRepository.ktsrc/main/resources/application-local.yamlsrc/main/resources/application-test.yamlsrc/main/resources/schema.sqlsrc/test/kotlin/co/yappuworld/operation/client/application/GenerationActiveStateManagerTest.kt
🚧 Files skipped from review as they are similar to previous changes (1)
- src/main/resources/application-local.yaml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
🔇 Additional comments (9)
src/main/resources/application-test.yaml (1)
6-13: Docker Compose 비활성화 및 H2 설정 확인H2 인메모리 데이터베이스로 전환하면서 Docker Compose를 비활성화한 것은 적절합니다.
MODE=Oracle과DATABASE_TO_LOWER=TRUE옵션으로 Oracle 호환성을 확보한 설정이 잘 되어 있습니다.src/main/kotlin/co/yappuworld/operation/infrastructure/GenerationRepository.kt (1)
7-9: LGTM!
KotlinJdslJpqlExecutor확장을 통해 JDSL 기반 타입 안전 쿼리가 가능해졌습니다. H2 호환성을 위한 적절한 접근 방식입니다.src/main/kotlin/co/yappuworld/operation/infrastructure/GenerationFindService.kt (1)
23-29: LGTM!
limit = 1과intLiteral(1)을 사용한 존재 여부 확인은 효율적인 패턴입니다. 전체 데이터를 로드하지 않고 빠르게 확인할 수 있습니다.src/main/kotlin/co/yappuworld/operation/client/application/GenerationActiveStateManager.kt (2)
17-19: LGTM!서비스 계층으로 활성 기수 조회 로직을 위임한 것은 적절한 리팩토링입니다. 관심사 분리가 잘 되어 있습니다.
43-54: 로직 흐름 적절함
existsActiveGeneration()조기 반환으로 빈 리스트 시나리오를 방지하고,checkDeactivatingConsistency()에서 복수 활성 기수를 검증한 후.single()을 호출하는 흐름이 안전합니다.src/test/kotlin/co/yappuworld/operation/client/application/GenerationActiveStateManagerTest.kt (1)
21-22: LGTM!
GenerationFindService를 수동으로 생성하여 주입하는 방식은 테스트에서 의존성을 명시적으로 제어할 수 있어 적절합니다. 새로운 생성자 시그니처와 일치하게 잘 업데이트되었습니다.src/main/resources/schema.sql (3)
115-117: generations 테이블도 동일한 VARCHAR 날짜 패턴 사용schedules 테이블과 동일하게
start_date,end_date가varchar(10)으로 정의되어 있습니다. 일관성 측면에서는 좋으나, 위에서 언급한 타입 안전성 고려사항이 동일하게 적용됩니다.
5-6: TIMESTAMP 및 NUMBER(1) 타입 변환 승인전체 스키마에 걸쳐 일관되게 적용된 타입 변환이 잘 되어 있습니다:
datetime(6)→TIMESTAMP: H2와 Oracle 모두 호환tinyint(1)→NUMBER(1): Oracle 스타일이지만 H2도 지원H2 테스트 환경과 Oracle 운영 환경 간의 호환성을 유지하면서 일관된 스키마 정의가 되었습니다.
Also applies to: 16-17, 24-24, 31-32, 43-44, 54-58
34-34: JSON 타입이 현재 환경에서 완벽하게 지원됩니다.H2 2.1.214 및 Oracle 23.5.0.24.07 모두 JSON 타입을 완벽하게 지원합니다. H2는 Oracle 호환 모드(MODE=Oracle)로 구성되어 있어 로컬/테스트 환경에서도 JSON 타입이 정상 작동합니다.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
src/main/kotlin/co/yappuworld/operation/infrastructure/GenerationFindService.kt
Show resolved
Hide resolved
* infra: h2 기반으로 ci 환경 구축 * infra: 테스트 스택트레이스 추가 * test: 테스트 수정
📌 Related Issue
🚨 해결하려는 문제가 무엇인가요?
⭐️ 어떻게 해결했나요?
🤔 어떤 부분에 집중하여 리뷰해야 할까요?
🗒️ 참고자료
RCA 룰
Summary by CodeRabbit
Chores (내부 개선)
Refactor (재구성)
Tests (테스트)
✏️ Tip: You can customize this high-level summary in your review settings.