[TEST] k6 테스트 시드 데이터와 주요 API별 병목 시나리오 구축 - #307
Conversation
|
Warning Review limit reached
Next review available in: 26 minutes 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 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Walkthroughk6 실행 설정이 환경변수 중심으로 변경되었습니다. 시드 프로필과 namespace 기반 생명주기, cardinality 검증, cleanup이 추가되었습니다. 단일 API arrival/ramping 부하 시나리오와 실행 결과 메타데이터 검증도 추가되었습니다. Changesk6 실행 계약과 환경 전달
시드 생명주기와 정확성 검증
단일 API 부하 시나리오
결과 메타데이터와 실행 문서
정적 및 안전성 검증
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant Runner as run-k6.sh
participant Scenario as single-api-read.js
participant Profiles as profiles.js
participant API as 읽기 API
Runner->>Scenario: 대상과 프로필 전달
Scenario->>Profiles: requestName별 실행 옵션 요청
Scenario->>API: 인증 헤더로 단일 API 호출
API-->>Scenario: 200 응답과 결과 반환
Scenario-->>Runner: 요약 및 threshold 결과 반환
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 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 |
|
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (5)
performance/k6/scripts/verify-single-api.sh (2)
162-164: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value실패 케이스의 환경 구성을 재사용하십시오.
이 호출은
base_env의 값을 손으로 다시 나열합니다.SEED_NAMESPACE만 다릅니다.base_env뒤에 덮어쓸 변수만 추가하면 중복이 사라집니다.♻️ 제안 리팩터
-expect_failure "missing seed manifest" env K6_ENV=local K6_ENV_FILE=/dev/null K6_STATE_DIR="$state_dir" \ - ENV_FILE=/dev/null BASE_URL=http://host.docker.internal:8080 MANAGEMENT_BASE_URL=http://host.docker.internal:8080 \ - K6_DRY_RUN=1 SEED_NAMESPACE=missing "$runner" api-timeline-list arrival +expect_failure "missing seed manifest" "${base_env[@]}" SEED_NAMESPACE=missing \ + "$runner" api-timeline-list arrival
env는 뒤에 지정한 할당을 우선 적용하므로SEED_NAMESPACE가 덮어써집니다.🤖 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 `@performance/k6/scripts/verify-single-api.sh` around lines 162 - 164, Update the “missing seed manifest” expect_failure invocation to reuse the existing base_env configuration instead of repeating its environment assignments. Append only the overriding SEED_NAMESPACE=missing value before invoking the existing runner command, preserving the current failure scenario and other environment settings.
54-69: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value불필요한
TIME_UNIT=1m환경을 제거하십시오.
single-api-read.js가TIME_UNIT을 읽지 않기 때문에TIME_UNIT=1m전달은 고정된timeUnit == "1s"검증과 충돌하지 않지만, 실행 환경에 헷갈리는 값을 남기므로 제거하는 것이 좋습니다.🤖 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 `@performance/k6/scripts/verify-single-api.sh` around lines 54 - 69, Remove the unused TIME_UNIT=1m environment variable from the inspect_options function’s docker compose command, while leaving the remaining k6 execution parameters unchanged.performance/k6/scripts/run-k6.sh (1)
79-91: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win
RPS_STAGES형식과 VU 상한값을 조기에 검증하십시오.
TARGET_RPS와START_RPS는 정규식으로 검증합니다.RPS_STAGES,PRE_ALLOCATED_VUS,MAX_VUS는 검증하지 않습니다.RPS_STAGES가 잘못된 형식이면 오류가 k6 실행 시점까지 지연됩니다. 컨테이너 기동 비용을 낭비합니다. 동일한 위치에서 검증하십시오.♻️ 제안 리팩터
PRE_ALLOCATED_VUS="${PRE_ALLOCATED_VUS:-20}" MAX_VUS="${MAX_VUS:-200}" [[ "$MAX_DROPPED_ITERATIONS" =~ ^[0-9]+$ ]] || die "MAX_DROPPED_ITERATIONS must be a non-negative integer" + [[ "$PRE_ALLOCATED_VUS" =~ ^[1-9][0-9]*$ ]] || die "PRE_ALLOCATED_VUS must be a positive integer" + [[ "$MAX_VUS" =~ ^[1-9][0-9]*$ ]] || die "MAX_VUS must be a positive integer" + (( MAX_VUS >= PRE_ALLOCATED_VUS )) || die "MAX_VUS must be greater than or equal to PRE_ALLOCATED_VUS" case "$profile_name" in @@ ramping) START_RPS="${START_RPS:-1}" RPS_STAGES="${RPS_STAGES:-10:2m,20:2m,40:2m,0:30s}" [[ "$START_RPS" =~ ^[0-9]+$ ]] || die "START_RPS must be a non-negative integer" + [[ "$RPS_STAGES" =~ ^[0-9]+:[0-9]+[smh](,[0-9]+:[0-9]+[smh])*$ ]] \ + || die "RPS_STAGES must use the '<rate>:<duration>' format separated by commas" ;;🤖 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 `@performance/k6/scripts/run-k6.sh` around lines 79 - 91, In the ramping branch of the profile validation case, add early validation for RPS_STAGES, PRE_ALLOCATED_VUS, and MAX_VUS alongside the existing START_RPS check. Reject malformed stage definitions and invalid VU limits with die before invoking k6, while preserving the current defaults and accepting only valid non-negative integer VU values.performance/k6/scripts/seed-state.sh (2)
1-10: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
die의존성을 파일 상단에 명시하십시오.이 스크립트는
die를 정의하지 않고run-k6.sh가 제공하는 함수를 사용합니다. 단독 실행 시 오류 처리가 동작하지 않습니다. sourcing 전제를 주석으로 기록하면 유지보수가 쉬워집니다.🤖 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 `@performance/k6/scripts/seed-state.sh` around lines 1 - 10, 문자열 요약: seed-state.sh가 run-k6.sh의 die 함수에 의존하지만 sourcing 전제가 명시되어 있지 않습니다. 파일 상단에 run-k6.sh가 die를 제공하며 이 스크립트는 해당 파일에서 source되어야 한다는 주석을 추가하고, die를 이 파일에서 재정의하지 마십시오.
170-190: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
umask 077이 프로세스 전체에 남습니다.
umask는 함수 스코프가 없습니다. 이 호출 이후 같은 셸에서 생성되는 모든 파일과 디렉터리의 권한이 바뀝니다. manifest 파일에만 제한하려면 서브셸로 감싸십시오.♻️ 제안 리팩터
- umask 077 - printf '%s\n' \ - "SEED_NAMESPACE=$SEED_NAMESPACE" \ + ( + umask 077 + printf '%s\n' \ + "SEED_NAMESPACE=$SEED_NAMESPACE" \ ... - "K6_GIT_COMMIT_SHA=$K6_GIT_COMMIT_SHA" > "$temporary_manifest" + "K6_GIT_COMMIT_SHA=$K6_GIT_COMMIT_SHA" > "$temporary_manifest" + )🤖 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 `@performance/k6/scripts/seed-state.sh` around lines 170 - 190, Update save_seed_manifest so umask 077 is applied only within a subshell covering manifest creation and replacement, preventing it from persisting in the parent shell. Preserve the existing manifest contents, atomic temporary-file move, mark_seed_manifest_latest call, and saved path output.
🤖 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 `@Makefile`:
- Around line 31-53: Update the RUN_PREFIX assignment in the k6-smoke, k6-seed,
k6-seed-cleanup, k6-mixed-read, k6-global-search, k6-scenario, and
k6-dry-mixed-read targets to preserve an existing RUN_PREFIX value, falling back
to K6_ENV/ENV only when it is unset. Keep the current K6_ENV fallback behavior
unchanged.
- Line 34: Update the k6 seed invocation in the Makefile target to pass an empty
positional profile argument instead of always expanding SEED_PROFILE with a
normal fallback, allowing run-k6.sh to resolve the value from the loaded env
file via its SEED_PROFILE fallback order.
In `@performance/k6/lib/auth.js`:
- Around line 108-123: Update authenticateExistingUser() to expose a separate
option controlling whether configuredAuth(authUser) may be used, preserving the
current default for non-seed callers. Disable that option in seedUser(),
verify-seed.js, and cleanup-seed.js so seed creation, reuse, verification, and
cleanup always authenticate the SEED_NAMESPACE user rather than TOKEN or
K6_ACCESS_TOKEN.
In `@performance/k6/lib/summary.js`:
- Around line 21-35: Compute runId() once in the surrounding summary-generation
flow and store the result in a local variable, then reuse that variable for both
the report path filename and metadata.run_id. Preserve the existing fallback
behavior while ensuring the filename and metadata always reference the same run
ID.
In `@performance/k6/scripts/verify-seed-runner.sh`:
- Around line 110-120: Update the permission check in the manifest validation
block of verify-seed-runner.sh to support both GNU/Linux stat and macOS BSD stat
syntax, while continuing to require permission mode 600. Preserve the existing
manifest existence and content checks, and use portable platform detection or a
compatible fallback rather than relying only on stat -c.
---
Nitpick comments:
In `@performance/k6/scripts/run-k6.sh`:
- Around line 79-91: In the ramping branch of the profile validation case, add
early validation for RPS_STAGES, PRE_ALLOCATED_VUS, and MAX_VUS alongside the
existing START_RPS check. Reject malformed stage definitions and invalid VU
limits with die before invoking k6, while preserving the current defaults and
accepting only valid non-negative integer VU values.
In `@performance/k6/scripts/seed-state.sh`:
- Around line 1-10: 문자열 요약: seed-state.sh가 run-k6.sh의 die 함수에 의존하지만 sourcing 전제가
명시되어 있지 않습니다. 파일 상단에 run-k6.sh가 die를 제공하며 이 스크립트는 해당 파일에서 source되어야 한다는 주석을
추가하고, die를 이 파일에서 재정의하지 마십시오.
- Around line 170-190: Update save_seed_manifest so umask 077 is applied only
within a subshell covering manifest creation and replacement, preventing it from
persisting in the parent shell. Preserve the existing manifest contents, atomic
temporary-file move, mark_seed_manifest_latest call, and saved path output.
In `@performance/k6/scripts/verify-single-api.sh`:
- Around line 162-164: Update the “missing seed manifest” expect_failure
invocation to reuse the existing base_env configuration instead of repeating its
environment assignments. Append only the overriding SEED_NAMESPACE=missing value
before invoking the existing runner command, preserving the current failure
scenario and other environment settings.
- Around line 54-69: Remove the unused TIME_UNIT=1m environment variable from
the inspect_options function’s docker compose command, while leaving the
remaining k6 execution parameters unchanged.
🪄 Autofix
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: 9bbc0ff0-ab48-4102-a7ed-745f27d02ad9
📒 Files selected for processing (23)
Makefileperformance/k6/README.mdperformance/k6/config/profiles.jsperformance/k6/env/local.env.exampleperformance/k6/lib/auth.jsperformance/k6/lib/data.jsperformance/k6/lib/seed.jsperformance/k6/lib/seedCardinality.jsperformance/k6/lib/summary.jsperformance/k6/scenarios/cleanup-seed.jsperformance/k6/scenarios/prepare-seed.jsperformance/k6/scenarios/single-api-read.jsperformance/k6/scenarios/verify-seed.jsperformance/k6/scripts/run-k6.shperformance/k6/scripts/seed-state.shperformance/k6/scripts/target-policy.shperformance/k6/scripts/verify-options.shperformance/k6/scripts/verify-runner.shperformance/k6/scripts/verify-seed-runner.shperformance/k6/scripts/verify-single-api.shperformance/k6/scripts/verify-summary.shperformance/k6/tests/seed-cardinality.jsperformance/k6/tests/summary-metadata.js
|
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
performance/k6/scripts/verify-seed-runner.sh (1)
168-169: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win
TOKEN환경변수 경로도 인증 정책 검증에 포함하십시오.
performance/k6/scripts/seed-state.sh는TOKEN과K6_ACCESS_TOKEN을 모두 거부해야 합니다. 현재 실행은K6_ACCESS_TOKEN만 설정하므로TOKEN처리의 회귀를 검출하지 못할 수 있습니다. 두 환경변수를 각각 격리하여seed-auth-policy.js를 실행하거나,performance/k6/tests/seed-auth-policy.js에서 두 경로를 모두 검사하십시오.🤖 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 `@performance/k6/scripts/verify-seed-runner.sh` around lines 168 - 169, Update the seed authentication policy verification around seed-auth-policy.js to also validate rejection of the TOKEN environment variable, alongside K6_ACCESS_TOKEN. Run each variable path in isolation or extend seed-auth-policy.js to cover both, ensuring seed-state.sh rejects both authentication variables.
🤖 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 `@performance/k6/scripts/verify-runner.sh`:
- Around line 250-262: Extend the verification block for the make seed
environment file to assert that SEED_NAMESPACE is propagated as make-env-light.
Add the corresponding expect_contains check alongside the existing seed_profile
and RUN_PREFIX assertions, using the same “Make seed namespace env file”
context.
In `@performance/k6/scripts/verify-summary.sh`:
- Around line 7-9: Before the report-generation flow in verify-summary.sh,
explicitly remove both "$report" and "$fallback_report" so stale JSON cannot be
reused; retain the existing EXIT trap for cleanup after execution.
- Around line 42-48: Update the fallback k6 invocation in the summary
verification flow to explicitly pass an empty RUN_ID environment value, ensuring
runId() uses its Date.now() fallback instead of inheriting the caller’s RUN_ID.
Keep the existing summary-fallback execution and validation behavior unchanged.
---
Nitpick comments:
In `@performance/k6/scripts/verify-seed-runner.sh`:
- Around line 168-169: Update the seed authentication policy verification around
seed-auth-policy.js to also validate rejection of the TOKEN environment
variable, alongside K6_ACCESS_TOKEN. Run each variable path in isolation or
extend seed-auth-policy.js to cover both, ensuring seed-state.sh rejects both
authentication variables.
🪄 Autofix
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: 3a6db3b6-ce5b-4d64-a96d-8616caca7410
📒 Files selected for processing (12)
Makefileperformance/k6/README.mdperformance/k6/lib/auth.jsperformance/k6/lib/summary.jsperformance/k6/scenarios/cleanup-seed.jsperformance/k6/scenarios/verify-seed.jsperformance/k6/scripts/verify-options.shperformance/k6/scripts/verify-runner.shperformance/k6/scripts/verify-seed-runner.shperformance/k6/scripts/verify-summary.shperformance/k6/tests/seed-auth-policy.jsperformance/k6/tests/summary-metadata.js
🚧 Files skipped from review as they are similar to previous changes (7)
- performance/k6/scenarios/cleanup-seed.js
- performance/k6/lib/auth.js
- performance/k6/lib/summary.js
- performance/k6/README.md
- performance/k6/scenarios/verify-seed.js
- performance/k6/scripts/verify-options.sh
- Makefile
|
📄 작업 내용 요약
📎 Issue 번호
✅ 작업 목록
📝 기타 참고사항
Summary by CodeRabbit
새로운 기능
버그 수정