Skip to content

test(redis): 클러스터 모드에서 전 스크립트 실행 (CY-235) - #20

Merged
UHeeJoon merged 4 commits into
developfrom
feature/CY-235-cluster-scripts
Aug 20, 2026
Merged

UHeeJoon merged 4 commits into
developfrom
feature/CY-235-cluster-scripts

Conversation

@UHeeJoon

@UHeeJoon UHeeJoon commented Aug 20, 2026 •

Copy link
Copy Markdown
Member

무엇을

전 스크립트(enqueue·queue_status·sweep·leader_acquire·leader_release)를
cluster-enabled yes 인 레디스에 실제로 태운다 (G3.4).

실측 — 무엇을 잡고 무엇을 못 잡나

태운 것 결과
선언된 KEYS 둘이 서로 다른 슬롯 CROSSSLOT 으로 거부
KEYS 에 없는 리터럴 키 통과한다
같은 슬롯 키 둘 통과

두 번째가 이 시험의 사각지대다. 한 노드가 전 슬롯을 가지면 미선언 키도
로컬이라 클러스터가 물지 않는다. 그래서 정적 검사(LuaKeysDeclarationTest)를
버릴 수 없고
, 그 경계를 시험으로 못 박았다.

왜 단독 노드인가

여러 노드를 띄우면 클러스터가 컨테이너 내부 주소를 돌려줘 밖에서 못 붙는다.
그 배선에 시간을 다 쓰면 정작 검증 대상인 스크립트를 못 태운다.

함정 하나

컨테이너 준비를 정적 초기화 블록에 두면 Awaitility 의 조건 평가 스레드가
JVM 클래스 초기화 락에 걸려 멈춘다 — 겉으로는 그냥 시간 초과로 보인다.
@BeforeAll 로 옮겼다.

Refs: CY-235

Summary by CodeRabbit

  • 테스트
    • Redis 클러스터 환경에서 Lua 스크립트 실행 호환성을 검증하는 통합 테스트를 추가했습니다.
    • 여러 키를 사용하는 스크립트의 슬롯 제약과 클러스터 오류 처리를 확인합니다.
    • 클러스터 초기화 및 정상 상태 전환 과정을 자동으로 검증합니다.

슬롯 교차는 단독 모드에서 조용히 통과하고 Phase 10 에서 터진다. 사각지대(미선언 키)도 시험으로 못 박아 정적 검사를 못 버리게 했다.

Refs: CY-235
정적 초기화 블록에서 기다리면 조건 평가 스레드가 클래스 초기화 락에 걸려 멈춘다. 겉으로는 시간 초과로만 보인다.

Refs: CY-235
@coderabbitai

coderabbitai Bot commented Aug 20, 2026 •

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • ai/journal/2026/08/AIJ-0023-cluster-mode.md is excluded by !**/*.md

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d7b7d083-a6a4-4bfb-8674-d10e061744b2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: da1b76b3-b72f-4285-9c94-dd5a10f785c5

📥 Commits

Reviewing files that changed from the base of the PR and between 8b79418 and a7a83bc.

⛔ Files ignored due to path filters (2)
  • ai/journal/2026/08/AIJ-0023-cluster-mode.md is excluded by !**/*.md
  • ai/journal/index.md is excluded by !**/*.md
📒 Files selected for processing (1)
  • src/test/java/com/kafkick/waiting/adapter/redis/ClusterModeScriptTest.java

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.


Walkthrough

Changes

Redis 클러스터 스크립트 검증

Layer / File(s) Summary
클러스터 초기화와 테스트 리소스 구성
src/test/java/com/kafkick/waiting/adapter/redis/ClusterModeScriptTest.java
Testcontainers로 Redis 클러스터를 시작한다. 전체 슬롯을 할당하고 클러스터 상태가 ok가 될 때까지 대기한다.
Lua 스크립트 검색과 실행 검증
src/test/java/com/kafkick/waiting/adapter/redis/ClusterModeScriptTest.java
Lua 파일을 정렬해 읽고 스크립트별 키와 인자를 매핑한다. 모든 스크립트의 실행 실패를 수집하고 최소 5개 스크립트 실행을 검증한다.
슬롯 오류와 비선언 키 검증
src/test/java/com/kafkick/waiting/adapter/redis/ClusterModeScriptTest.java
서로 다른 슬롯의 키가 CROSSSLOT 오류를 발생시키는지 검증한다. 단일 노드 전체 슬롯 환경에서 KEYS 외부 키 사용이 성공할 수 있는지도 검증한다.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to a7a83

This change adds Redis cluster-mode test coverage and supporting documentation without introducing a production behavior change; no actionable merge-blocking risk remains beyond normal checks.

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 36.36% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 Redis 클러스터 모드에서 모든 스크립트를 실행하는 통합 테스트 추가라는 주요 변경 사항을 정확히 설명합니다.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/CY-235-cluster-scripts

Comment @coderabbitai help to get the list of available commands.

형식을 확인하지 않고 앞 글의 본문만 베껴 프론트매터를 빠뜨렸다.

Refs: CY-235
@UHeeJoon
UHeeJoon merged commit a3f25e3 into develop Aug 20, 2026
17 checks passed
@UHeeJoon
UHeeJoon deleted the feature/CY-235-cluster-scripts branch August 20, 2026 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant