[Test] 일부 시나리오 한정 통합 테스트 코드 작성 - #30
githyj-jang wants to merge 8 commits into
Conversation
예약생성 한정. 다른 파트의 경우 단순 시나리오상 호출되는 내부 api 호출 테스트
…and clarifications
📝 WalkthroughWalkthroughIntelliJ HTTP Client 기반 로컬 멀티서비스 통합 테스트 시나리오, 시드/리셋 SQL, 서비스 시작 스크립트 및 환경 파일을 추가하고, Feign 클라이언트에서 명시적 URL을 제거해 Eureka 서비스 디스커버리를 사용하도록 설정을 변경했습니다. (문서/구성/테스트 중심 변경) Changes로컬 HTTP 통합 테스트 및 서비스 디스커버리 설정
Sequence Diagram(s)sequenceDiagram
participant Dev as "개발자 (IntelliJ HTTP Client)"
participant Gateway as "API Gateway"
participant Eureka as "Eureka"
participant Reservation as "reservation-service"
participant Waiting as "waiting-service"
participant TimeSlot as "timeslot-service"
participant DB as "PostgreSQL"
Dev->>Gateway: HTTP 시나리오 요청 (signup / login / 예약 등)
Gateway->>Eureka: 서비스 조회 (lb://)
Eureka-->>Gateway: 서비스 인스턴스 반환
Gateway->>Reservation: 사용자/예약 관련 API 전달
Reservation->>Waiting: 토큰 검증 / 대기 상태 확인 (Feign via Eureka)
Reservation->>TimeSlot: 시간대 조회 / 재고 감소 (Feign via Eureka)
Reservation->>DB: 예약 저장 / 조회
Reservation-->>Gateway: 응답 반환
Gateway-->>Dev: 최종 응답 전달
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (1 warning, 2 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 9
🧹 Nitpick comments (2)
http-tests/start-local.sh (1)
10-15: ⚡ Quick win스크립트 실행 위치에 따른 경로 문제 가능성
dirname "$0"은 스크립트가 호출된 방식에 따라 상대 경로를 반환할 수 있습니다. 예를 들어, 다른 디렉토리에서./http-tests/start-local.sh로 호출하면ROOT가./http-tests가 되어 서비스 디렉토리를 찾지 못할 수 있습니다.♻️ 절대 경로로 변환하는 수정 제안
-ENV_FILE="$(dirname "$0")/infra/.env" +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +ENV_FILE="$SCRIPT_DIR/infra/.env" if [ -f "$ENV_FILE" ]; then export $(grep -v '^#' "$ENV_FILE" | xargs) fi -ROOT="$(dirname "$0")" +ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"🤖 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 `@http-tests/start-local.sh` around lines 10 - 15, The script uses dirname "$0" which yields a relative path depending on how the script is invoked; update start-local.sh so ENV_FILE and ROOT are computed as absolute paths instead of relative ones (e.g., resolve the script directory via realpath or by cd-ing to dirname "$0" and using pwd) so ENV_FILE points to infra/.env reliably and ROOT references the repository's http-tests directory even when invoked from another cwd; change the assignments that set ENV_FILE and ROOT (the variables named ENV_FILE and ROOT) to use the resolved absolute script directory.http-tests/sql/seed_test_data.sql (1)
247-265: 💤 Low value서브쿼리 NULL 반환 가능성 검토 필요
time_slot_id조회 서브쿼리가 해당 날짜/시간의 타임슬롯이 없으면 NULL을 반환합니다. 스크립트 내 INSERT 순서상 문제없지만, 부분 실행 시NOT NULL제약 위반이 발생할 수 있습니다.🤖 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 `@http-tests/sql/seed_test_data.sql` around lines 247 - 265, The subquery fetching time_slot_id from timeslot_service.p_time_slot can return NULL (causing NOT NULL constraint failures when the script is partially run); update the seed to guarantee a non-null time_slot_id by either: 1) pre-selecting the time_slot_id (SELECT time_slot_id FROM timeslot_service.p_time_slot WHERE target_date='2026-06-14' AND start_time='18:00' LIMIT 1) and aborting with a clear error if no row exists before running the INSERT, or 2) replacing the inline subquery with a defensive expression that provides a deterministic fallback (e.g., a COALESCE around the subquery to an explicit valid time_slot_id or a nearest-match SELECT), and reference the time_slot_id and timeslot_service.p_time_slot identifiers in your change so the INSERT tuple in seed_test_data.sql always receives a non-null value.
🤖 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 `@http-tests/LOCAL_TEST_GUIDE.md`:
- Around line 62-63: The datasource URL placeholders are missing a closing
brace, breaking the YAML placeholder syntax; update the datasource URL
occurrences (the lines containing the jdbc:postgresql URL and the placeholders
${POSTGRES_PORT:5432 and ${POSTGRES_DB:michelet_db}) to add the missing '}'
after ${POSTGRES_PORT:5432} (making it ${POSTGRES_PORT:5432}) and verify the
closing braces for ${POSTGRES_DB:michelet_db} as well so both datasource URL
instances are valid placeholders.
In `@http-tests/scenario1a_setup.http`:
- Around line 21-23: The check for required fields is currently guarded by an if
and thus silently skips failing when response.body or response.body.data is
missing; change the logic to assert existence unconditionally by using
client.assert to verify response.body exists, response.body.data exists, and
response.body.data.userId is not undefined (replace the conditional block around
response.body.data.userId with explicit assertions using client.assert on
response.body, response.body.data, and response.body.data.userId); apply the
same pattern for the other occurrences that validate required fields (the blocks
around lines referencing response.body.data at the noted occurrences).
In `@http-tests/scenario1b_reservation.http`:
- Around line 37-40: When the search result array opened is empty you must
immediately fail and clear any previous globals to avoid reusing old
targetDate/timeSlotId; change the block that currently only sets
client.global.set("targetDate", opened[0].date) to check if opened.length === 0
and in that case call the test failure path (throw an Error or use the test
runner's fail API) and remove/clear client.global values for "targetDate" and
"timeSlotId"; apply the same fix to the analogous block that sets timeSlotId
(the 57-61 block) so neither targetDate nor timeSlotId remain from prior runs
when no options are returned.
- Around line 16-20: The check that currently only logs when status !== "ACTIVE"
allows WAITING to pass erroneously; update the block that reads the status
variable and uses client.log so that if status !== "ACTIVE" the test explicitly
fails (e.g., throw an Error or call the test runner's failure API) with a clear
message like "Expected ACTIVE but got <status>; aborting STEP" instead of merely
logging, leaving the success branch (status === "ACTIVE") to log the proceed
message. Ensure you modify the conditional around status and client.log to
enforce failure.
In `@http-tests/scenario2_checkin.http`:
- Around line 14-16: The test currently accesses response.body.data without
asserting the presence of the body/schema, so missing response structures can
let the test pass; update the STEP to first assert response.body and
response.body.data exist (e.g., use client.assert(response.body, ...) and
client.assert(response.body.data, ...)) before asserting
response.body.data.exists, and apply the same fix to the other occurrence that
checks exists (the block that currently uses
client.assert(response.body.data.exists === true, ...)); ensure the failure
messages clearly indicate which part of the schema is missing so the test fails
when the response body/schema is absent.
In `@http-tests/sql/reset_test_data.sql`:
- Around line 15-29: The DELETE order is wrong: since reservation rows in
reservation_db.p_reservations reference timeslot_service.p_time_slot, delete the
reservations first (the DELETE statement with id IN (...)), then delete timeslot
rows (DELETE FROM timeslot_service.p_time_slot WHERE restaurant_id = ...), and
after that remove course-menu, course and restaurant rows (the DELETEs for
restaurant_service.p_restaurant_course_menu, p_restaurant_course, and
p_restaurant) so child tables are cleared before their parent tables to avoid FK
constraint violations.
In `@http-tests/start-local.sh`:
- Around line 11-13: 현재 ENV_FILE 로드에서 grep 결과를 xargs로 전달해 공백이 포함된 값이 잘못 분리되는 문제가
있습니다; ENV_FILE 처리부를 변경해 xargs를 제거하고 대신 grep -v '^#' "$ENV_FILE" | while IFS=
read -r line; do [ -z "$line" ] || export "$line"; done 사용하여 각 줄을 그대로 읽고 export
하거나 set -a; . "$ENV_FILE"; set +a 방식으로 파일을 안전하게 소스하도록 수정하세요 (참조: 변수 ENV_FILE 및
기존 xargs 사용 부분).
In `@src/main/resources/application.yaml`:
- Line 13: 현재 기본값으로 설정된 spring.jpa.hibernate.ddl-auto: create는 환경변수 미설정 시 위험하므로
기본값을 create에서 none(또는 validate)로 변경하고, 개발 로컬에서만 create를 사용하도록 프로파일 기반 설정을 추가하세요;
구체적으로 설정키 spring.jpa.hibernate.ddl-auto의 전역 값을 none 또는 validate로 바꾸고, 로컬
프로파일(application-local) 설정에만 ddl-auto: create를 명시해 애플리케이션 시작 시 프로덕션에서 테이블 재생성이
일어나지 않도록 수정하세요.
- Around line 49-51: InternalSecretFeignConfig.java still injects the old
property key; update the `@Value` injection in InternalSecretFeignConfig (the
field or constructor annotated with `@Value`("${internal.secret:}") ) to use the
new path `@Value`("${internal.auth.secret:}") (or alternatively make application
config provide internal.secret) so the property key is consistent and the
missing-configuration startup error is resolved.
---
Nitpick comments:
In `@http-tests/sql/seed_test_data.sql`:
- Around line 247-265: The subquery fetching time_slot_id from
timeslot_service.p_time_slot can return NULL (causing NOT NULL constraint
failures when the script is partially run); update the seed to guarantee a
non-null time_slot_id by either: 1) pre-selecting the time_slot_id (SELECT
time_slot_id FROM timeslot_service.p_time_slot WHERE target_date='2026-06-14'
AND start_time='18:00' LIMIT 1) and aborting with a clear error if no row exists
before running the INSERT, or 2) replacing the inline subquery with a defensive
expression that provides a deterministic fallback (e.g., a COALESCE around the
subquery to an explicit valid time_slot_id or a nearest-match SELECT), and
reference the time_slot_id and timeslot_service.p_time_slot identifiers in your
change so the INSERT tuple in seed_test_data.sql always receives a non-null
value.
In `@http-tests/start-local.sh`:
- Around line 10-15: The script uses dirname "$0" which yields a relative path
depending on how the script is invoked; update start-local.sh so ENV_FILE and
ROOT are computed as absolute paths instead of relative ones (e.g., resolve the
script directory via realpath or by cd-ing to dirname "$0" and using pwd) so
ENV_FILE points to infra/.env reliably and ROOT references the repository's
http-tests directory even when invoked from another cwd; change the assignments
that set ENV_FILE and ROOT (the variables named ENV_FILE and ROOT) to use the
resolved absolute script directory.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: cdc5cd86-2e58-4c79-ad20-34efeb5a5148
📒 Files selected for processing (13)
http-tests/LOCAL_TEST_GUIDE.mdhttp-tests/http-client.env.jsonhttp-tests/scenario1a_setup.httphttp-tests/scenario1b_reservation.httphttp-tests/scenario2_checkin.httphttp-tests/scenario3_history_check.httphttp-tests/sql/reset_test_data.sqlhttp-tests/sql/seed_test_data.sqlhttp-tests/start-local.shsrc/main/java/com/michelet/reservation/infrastructure/client/TimeSlotClient.javasrc/main/java/com/michelet/reservation/infrastructure/client/WaitingClient.javasrc/main/resources/application-local.yamlsrc/main/resources/application.yaml
💤 Files with no reviewable changes (1)
- src/main/java/com/michelet/reservation/infrastructure/client/TimeSlotClient.java
| if (response.body && response.body.data) { | ||
| client.assert(response.body.data.userId !== undefined, "userId 반환 확인"); | ||
| } |
There was a problem hiding this comment.
핵심 필드 검증이 조건부라 초기 단계 오탐이 발생할 수 있습니다.
현재 구조는 본문 누락 시 실패하지 않아, 다음 STEP에서 이전 전역값을 재사용하며 시나리오가 왜곡될 수 있습니다. 각 STEP에서 필수 필드 존재를 조건문 밖에서 강제하는 편이 안전합니다.
수정 패턴 예시
- if (response.body && response.body.data) {
- client.assert(response.body.data.userId !== undefined, "userId 반환 확인");
- }
+ client.assert(response.body && response.body.data, "response.body.data 누락");
+ client.assert(response.body.data.userId !== undefined, "userId 반환 확인");Also applies to: 44-46, 62-64, 94-96, 120-123
🤖 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 `@http-tests/scenario1a_setup.http` around lines 21 - 23, The check for
required fields is currently guarded by an if and thus silently skips failing
when response.body or response.body.data is missing; change the logic to assert
existence unconditionally by using client.assert to verify response.body exists,
response.body.data exists, and response.body.data.userId is not undefined
(replace the conditional block around response.body.data.userId with explicit
assertions using client.assert on response.body, response.body.data, and
response.body.data.userId); apply the same pattern for the other occurrences
that validate required fields (the blocks around lines referencing
response.body.data at the noted occurrences).
| if (opened.length > 0) { | ||
| client.global.set("targetDate", opened[0].date); | ||
| client.log("예약 가능 날짜: " + opened[0].date); | ||
| } |
There was a problem hiding this comment.
OPENED 날짜/가용 슬롯 미존재 시 즉시 실패 처리가 필요합니다.
선택 결과가 없을 때 실패하지 않아 targetDate/timeSlotId가 이전 값으로 남아 잘못된 예약을 만들 수 있습니다.
수정 예시
var opened = slots.filter(function(s) { return s.status === "OPENED"; });
+ client.assert(opened.length > 0, "OPENED 상태 날짜가 필요합니다.");
if (opened.length > 0) {
client.global.set("targetDate", opened[0].date);
client.log("예약 가능 날짜: " + opened[0].date);
}
var available = response.body.data.filter(function(s) {
return s.remainingCapacity > 0;
});
+ client.assert(available.length > 0, "남은 좌석이 있는 타임슬롯이 필요합니다.");
if (available.length > 0) {
client.global.set("timeSlotId", available[0].timeSlotId);Also applies to: 57-61
🤖 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 `@http-tests/scenario1b_reservation.http` around lines 37 - 40, When the search
result array opened is empty you must immediately fail and clear any previous
globals to avoid reusing old targetDate/timeSlotId; change the block that
currently only sets client.global.set("targetDate", opened[0].date) to check if
opened.length === 0 and in that case call the test failure path (throw an Error
or use the test runner's fail API) and remove/clear client.global values for
"targetDate" and "timeSlotId"; apply the same fix to the analogous block that
sets timeSlotId (the 57-61 block) so neither targetDate nor timeSlotId remain
from prior runs when no options are returned.
| if (response.body && response.body.data) { | ||
| client.assert(response.body.data.exists === true, "예약 존재 확인 (exists=true)"); | ||
| } |
There was a problem hiding this comment.
응답 본문 누락 시 테스트가 통과할 수 있습니다.
response.body.data가 없을 때 실패 처리하지 않아, 스키마 깨짐을 놓칠 수 있습니다. 각 STEP에서 필수 응답 구조를 먼저 강제하세요.
수정 예시
client.test("예약 존재 여부 확인 성공", function() {
client.assert(response.status === 200, "Expected 200 OK but got " + response.status);
- if (response.body && response.body.data) {
- client.assert(response.body.data.exists === true, "예약 존재 확인 (exists=true)");
- }
+ client.assert(response.body && response.body.data, "response.body.data 누락");
+ client.assert(response.body.data.exists === true, "예약 존재 확인 (exists=true)");
});
client.test("체크인 성공", function() {
client.assert(response.status === 200, "Expected 200 OK but got " + response.status);
- if (response.body && response.body.data) {
- client.assert(response.body.data.status === "COMPLETED", "예약 상태 COMPLETED 확인");
- client.assert(response.body.data.checkedInAt !== null, "체크인 시각 기록 확인");
- }
+ client.assert(response.body && response.body.data, "response.body.data 누락");
+ client.assert(response.body.data.status === "COMPLETED", "예약 상태 COMPLETED 확인");
+ client.assert(response.body.data.checkedInAt !== null, "체크인 시각 기록 확인");
});Also applies to: 35-38
🤖 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 `@http-tests/scenario2_checkin.http` around lines 14 - 16, The test currently
accesses response.body.data without asserting the presence of the body/schema,
so missing response structures can let the test pass; update the STEP to first
assert response.body and response.body.data exist (e.g., use
client.assert(response.body, ...) and client.assert(response.body.data, ...))
before asserting response.body.data.exists, and apply the same fix to the other
occurrence that checks exists (the block that currently uses
client.assert(response.body.data.exists === true, ...)); ensure the failure
messages clearly indicate which part of the schema is missing so the test fails
when the response body/schema is absent.
There was a problem hiding this comment.
Pull request overview
로컬에서 Eureka + Feign(lb://) 기반으로 여러 서비스 연동 시나리오를 재현하기 위한 IntelliJ HTTP Client 통합 테스트 시나리오/시드데이터/가이드를 추가하고, reservation-service 설정을 서비스 디스커버리 기반 호출로 전환한 PR입니다.
Changes:
- 로컬 통합 테스트를 위한 HTTP 시나리오(예약 생성/체크인/방문이력 검증)와 환경 파일 추가
- 로컬 시드/리셋 SQL 및 실행 가이드/기동 스크립트 추가
- FeignClient를 URL 직접 지정에서 Eureka 디스커버리 기반으로 변경하고, 로컬 프로파일에서 stub 호출 비활성화
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/resources/application.yaml | DB/hibernate/eureka 등 기본 설정 변경(서비스 디스커버리 기반 전환) |
| src/main/resources/application-local.yaml | local 프로파일에서 waiting/timeslot stub 비활성화 |
| src/main/java/com/michelet/reservation/infrastructure/client/WaitingClient.java | FeignClient URL 제거(디스커버리 기반) |
| src/main/java/com/michelet/reservation/infrastructure/client/TimeSlotClient.java | FeignClient URL 제거(디스커버리 기반) |
| http-tests/start-local.sh | 로컬 멀티서비스 기동 스크립트 추가 |
| http-tests/sql/seed_test_data.sql | 로컬 통합 테스트 시드 데이터 추가 |
| http-tests/sql/reset_test_data.sql | 시드 데이터 리셋 SQL 추가 |
| http-tests/scenario1a_setup.http | 시나리오 1A(회원가입~대기열 등록) HTTP 테스트 추가 |
| http-tests/scenario1b_reservation.http | 시나리오 1B(대기 상태 확인~예약 생성/조회) HTTP 테스트 추가 |
| http-tests/scenario2_checkin.http | 시나리오 2(내부 API 체크인) HTTP 테스트 추가 |
| http-tests/scenario3_history_check.http | 시나리오 3(내부 API 방문이력 검증) HTTP 테스트 추가 |
| http-tests/LOCAL_TEST_GUIDE.md | 로컬 통합 테스트 실행 가이드 추가 |
| http-tests/http-client.env.json | IntelliJ HTTP Client 환경 변수 파일 추가 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| jpa: | ||
| hibernate: | ||
| ddl-auto: ${SPRING_JPA_HIBERNATE_DDL_AUTO:update} | ||
| ddl-auto: ${SPRING_JPA_HIBERNATE_DDL_AUTO:create} |
| hibernate: | ||
| dialect: org.hibernate.dialect.PostgreSQLDialect | ||
| default_schema: public | ||
| default_schema: reservation_service |
| jdbc: | ||
| batch_size: 30 | ||
| order_inserts: true | ||
| order_updates: true |
| url: ${FEIGN_TIMESLOT_SERVICE_URL:http://localhost:19400} | ||
| waiting-service: | ||
| url: ${FEIGN_WAITING_SERVICE_URL:http://localhost:19300} | ||
| internal: |
| -- 6. 예약 (reservation_db.p_reservations) — 시나리오 3 검증용 CONFIRMED 데이터 | ||
| -- owneruser01이 본인 식당에 예약한 데이터로 생성 (임시) | ||
| -- ============================================================ | ||
| INSERT INTO reservation_db.p_reservations ( |
| DELETE FROM restaurant_service.p_restaurant | ||
| WHERE restaurant_id = '2589a05e-db8f-4e62-bb3d-22ce85b750a3'; | ||
|
|
||
| DELETE FROM reservation_db.p_reservations |
| spring: | ||
| datasource: | ||
| url: jdbc:postgresql://localhost:${POSTGRES_PORT:5432/${POSTGRES_DB:michelet_db} | ||
| username: ${POSTGRES_USER:admin} | ||
| password: ${POSTGRES_PASSWORD:admin} | ||
| driver-class-name: org.postgresql.Driver |
|
|
||
| spring: | ||
| datasource: | ||
| url: jdbc:postgresql://localhost:${POSTGRES_PORT:5432/${POSTGRES_DB:michelet_db} | ||
| username: ${POSTGRES_USER:admin} | ||
| password: ${POSTGRES_PASSWORD:admin} | ||
| driver-class-name: org.postgresql.Driver |
| ### 1. 인프라 및 DB 준비 | ||
|
|
||
| ```bash | ||
| # 1. 인프라 시작 (PostgreSQL, Redis 등) | ||
| cd infra && docker-compose -f docker-compose.infra.yml up -d | ||
|
|
||
| # 2. 테스트 데이터 리셋 및 시드 투입 (필수) | ||
| docker exec -i db psql -U admin -d michelet_db < http-tests/sql/reset_test_data.sql | ||
| docker exec -i db psql -U admin -d michelet_db < http-tests/sql/seed_test_data.sql | ||
| ``` |
| ROOT="$(dirname "$0")" | ||
|
|
||
| run_service() { | ||
| local svc=$1 | ||
| local profile=${2:-local} | ||
| local extra_args=${3:-} | ||
|
|
||
| echo "▶ Starting $svc (profile=$profile)..." | ||
| cd "$ROOT/$svc" | ||
| chmod +x gradlew |
# Conflicts: # src/main/java/com/michelet/reservation/infrastructure/client/TimeSlotClient.java # src/main/resources/application.yaml
There was a problem hiding this comment.
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/resources/application.yaml (1)
7-8:⚠️ Potential issue | 🟠 Major | ⚡ Quick win기본
application.yaml에 DB 기본 계정(admin/admin)을 두면 운영 누락 시 취약해집니다.베이스 프로파일은 운영에도 도달 가능하므로, 기본값은 제거하고 로컬 전용 프로파일로만 내려주세요.
🔧 수정 제안
- username: ${DB_USER:admin} - password: ${DB_PASSWORD:admin} + username: ${DB_USER} + password: ${DB_PASSWORD}
application-local.yaml에만 기본값 유지:spring: datasource: username: ${DB_USER:admin} password: ${DB_PASSWORD:admin}Based on learnings: For this Spring Boot project’s application YAML configs, default DB credentials must be limited to dev/local only and flagged if production-reachable.
🤖 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/resources/application.yaml` around lines 7 - 8, Remove the hardcoded DB default values from the base application.yaml by deleting the default fallbacks in the properties (replace spring.datasource.username: ${DB_USER:admin} and spring.datasource.password: ${DB_PASSWORD:admin} with environment-only placeholders like ${DB_USER} and ${DB_PASSWORD}), and add the default admin/admin values only into application-local.yaml under spring.datasource.username and spring.datasource.password so local/dev keeps the defaults while production/profile-readables do not.
🤖 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 `@http-tests/LOCAL_TEST_GUIDE.md`:
- Around line 109-113: The current guide changes directory with "cd infra &&
docker-compose -f docker-compose.infra.yml up -d" which breaks the subsequent
relative SQL paths used by the two "docker exec -i db psql -U admin -d
michelet_db < http-tests/sql/..." commands; fix by avoiding a persistent cd
(either run docker-compose from the repo root with "docker-compose -f
infra/docker-compose.infra.yml up -d" or scope the cd in a subshell "(cd infra
&& docker-compose -f docker-compose.infra.yml up -d)"), leaving the two docker
exec lines' relative paths unchanged, or alternatively convert those SQL paths
to repository-root absolute/anchored paths (e.g., "./http-tests/sql/...") so
they resolve correctly regardless of the current working directory.
---
Outside diff comments:
In `@src/main/resources/application.yaml`:
- Around line 7-8: Remove the hardcoded DB default values from the base
application.yaml by deleting the default fallbacks in the properties (replace
spring.datasource.username: ${DB_USER:admin} and spring.datasource.password:
${DB_PASSWORD:admin} with environment-only placeholders like ${DB_USER} and
${DB_PASSWORD}), and add the default admin/admin values only into
application-local.yaml under spring.datasource.username and
spring.datasource.password so local/dev keeps the defaults while
production/profile-readables do not.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 039a924d-813b-4492-afab-04fb31b5fbc1
📒 Files selected for processing (8)
build.gradlehttp-tests/LOCAL_TEST_GUIDE.mdhttp-tests/scenario1b_reservation.httphttp-tests/sql/reset_test_data.sqlhttp-tests/sql/seed_test_data.sqlhttp-tests/start-local.shsrc/main/resources/application-local.yamlsrc/main/resources/application.yaml
✅ Files skipped from review due to trivial changes (2)
- http-tests/sql/reset_test_data.sql
- http-tests/scenario1b_reservation.http
🚧 Files skipped from review as they are similar to previous changes (3)
- http-tests/start-local.sh
- http-tests/sql/seed_test_data.sql
- src/main/resources/application-local.yaml
| cd infra && docker-compose -f docker-compose.infra.yml up -d | ||
|
|
||
| # 2. 테스트 데이터 리셋 및 시드 투입 (필수) | ||
| docker exec -i db psql -U admin -d michelet_db < http-tests/sql/reset_test_data.sql | ||
| docker exec -i db psql -U admin -d michelet_db < http-tests/sql/seed_test_data.sql |
There was a problem hiding this comment.
명령 블록의 작업 디렉터리 전환 때문에 SQL 경로가 깨질 수 있습니다.
cd infra 이후 같은 세션에서 다음 줄을 실행하면 http-tests/sql/... 상대경로가 실패할 수 있습니다.
🔧 수정 제안
-# 1. 인프라 시작 (PostgreSQL, Redis 등)
-cd infra && docker-compose -f docker-compose.infra.yml up -d
+# 1. 인프라 시작 (PostgreSQL, Redis 등)
+docker compose -f infra/docker-compose.infra.yml up -d
# 2. 테스트 데이터 리셋 및 시드 투입 (필수)
docker exec -i db psql -U admin -d michelet_db < http-tests/sql/reset_test_data.sql
docker exec -i db psql -U admin -d michelet_db < http-tests/sql/seed_test_data.sql🤖 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 `@http-tests/LOCAL_TEST_GUIDE.md` around lines 109 - 113, The current guide
changes directory with "cd infra && docker-compose -f docker-compose.infra.yml
up -d" which breaks the subsequent relative SQL paths used by the two "docker
exec -i db psql -U admin -d michelet_db < http-tests/sql/..." commands; fix by
avoiding a persistent cd (either run docker-compose from the repo root with
"docker-compose -f infra/docker-compose.infra.yml up -d" or scope the cd in a
subshell "(cd infra && docker-compose -f docker-compose.infra.yml up -d)"),
leaving the two docker exec lines' relative paths unchanged, or alternatively
convert those SQL paths to repository-root absolute/anchored paths (e.g.,
"./http-tests/sql/...") so they resolve correctly regardless of the current
working directory.
📝 작업 내용
🚀 주요 변경 사항
✅ 자체 체크리스트 (필수)
./gradlew build실행 결과 정상 (인증샷 첨부)📸 테스트 인증샷
💬 리뷰어 전달사항 (선택)
📎 참고 자료
Summary by CodeRabbit
릴리즈 노트
문서
테스트
기타