Edge Server와 Node Client 간 패킷(CapabilityRequest, RunRequest 등) 통신 흐름을 검증하는 통합 네트워크 테스트를 작성했다. Mock Client/Server를 사용하여 Go의 internal 패키지 규칙을 준수하면서 양측 통신을 완전하게 검증할 수 있다.
147 lines
6.1 KiB
Text
147 lines
6.1 KiB
Text
<!-- task=edge_node_integration plan=0 tag=TEST -->
|
|
|
|
# Code Review Reference - TEST
|
|
|
|
## 개요
|
|
|
|
date=2026-05-02
|
|
task=edge_node_integration, plan=0, tag=TEST
|
|
|
|
## 이 파일을 읽는 리뷰 에이전트에게
|
|
|
|
각 항목의 구현을 실제 소스 파일과 대조하고, `검증 결과` 섹션의 출력이 코드와 일치하는지 확인하세요.
|
|
리뷰 완료 후 반드시 아래 순서로 아카이브하세요.
|
|
|
|
1. `CODE_REVIEW.md` → `code_review_N.log` (N = 기존 code_review_*.log 수)
|
|
2. `PLAN.md` → `plan_M.log` (M = 기존 plan_*.log 수)
|
|
3. PASS인 경우 `complete.log` 작성 후 종료. WARN/FAIL인 경우 새 `PLAN.md` + `CODE_REVIEW.md` 스텁 작성.
|
|
|
|
---
|
|
|
|
## 구현 항목별 완료 여부
|
|
|
|
| 항목 | 완료 여부 |
|
|
|------|---------|
|
|
| [TEST-1] Edge Server 통합 테스트 | [x] |
|
|
| [TEST-2] Node Client 통합 테스트 | [x] |
|
|
|
|
## 계획 대비 변경 사항
|
|
|
|
- 계획서의 요구 파일(`apps/edge/internal/transport/integration_test.go`, `apps/node/internal/transport/integration_test.go`)만 수정했다.
|
|
- `apps/node/internal/transport/integration_test.go`에서는 고정 `time.Sleep` 대신 서버 accept 채널 대기를 사용해 플래키 가능성을 줄였다.
|
|
- 최종 검증은 계획서의 명령(`go test -v ./apps/edge/... ./apps/node/...`)까지 확대 실행해 transport 외 연관 패키지 회귀도 함께 확인했다.
|
|
|
|
## 주요 설계 결정
|
|
|
|
- Go `internal` 규칙을 지키기 위해 edge/node 통합 테스트를 각 앱의 `internal/transport` 패키지 안에서 분리 유지했다.
|
|
- 양쪽 테스트 모두 실제 TCP 소켓을 열고, 반대편 역할은 `common-proto-socket` 기반 mock client/server로 대체해 네트워크 계층을 직접 검증했다.
|
|
- Edge 테스트는 registry 등록 여부뿐 아니라 등록된 `NodeEntry`의 `NodeID`/adapter 메타데이터까지 확인하도록 구성했다.
|
|
- Node 테스트는 `CapabilityRequest` 응답 확인에 더해 `RunRequest` 수신과 `RunEvent` 반환까지 왕복 흐름으로 검증했다.
|
|
|
|
## 리뷰어를 위한 체크포인트
|
|
|
|
- `apps/edge/internal/transport/integration_test.go`에서 소켓 기반 연결을 통해 Node 등록 흐름이 정상 작동하는가?
|
|
- `apps/node/internal/transport/integration_test.go`에서 Mock Server와의 소켓 연결 및 메시지 처리(`CapabilityRequest`, `RunRequest` 등)가 정상 작동하는가?
|
|
- 테스트 종료 시 서버 포트가 정상 릴리즈되는가?
|
|
|
|
## 검증 결과
|
|
|
|
### 중간 검증
|
|
```
|
|
$ go test -count=1 -v ./apps/edge/internal/transport ./apps/node/internal/transport
|
|
=== RUN TestEdgeServerIntegration
|
|
--- PASS: TestEdgeServerIntegration (0.03s)
|
|
PASS
|
|
ok iop/apps/edge/internal/transport 0.655s
|
|
=== RUN TestNodeParserMap_RunRequest
|
|
--- PASS: TestNodeParserMap_RunRequest (0.00s)
|
|
=== RUN TestNodeParserMap_CancelRequest
|
|
--- PASS: TestNodeParserMap_CancelRequest (0.00s)
|
|
=== RUN TestNodeParserMap_CapabilityRequest
|
|
--- PASS: TestNodeParserMap_CapabilityRequest (0.00s)
|
|
=== RUN TestNodeClientIntegration
|
|
--- PASS: TestNodeClientIntegration (0.00s)
|
|
=== RUN TestSession_RegisterCancel_CancelRun
|
|
--- PASS: TestSession_RegisterCancel_CancelRun (0.00s)
|
|
=== RUN TestSession_DeregisterCancel
|
|
--- PASS: TestSession_DeregisterCancel (0.00s)
|
|
=== RUN TestSession_CancelRun_UnknownID
|
|
--- PASS: TestSession_CancelRun_UnknownID (0.00s)
|
|
=== RUN TestSession_ConcurrentRegisterCancel
|
|
--- PASS: TestSession_ConcurrentRegisterCancel (0.00s)
|
|
PASS
|
|
ok iop/apps/node/internal/transport 1.143s
|
|
```
|
|
|
|
### 최종 검증
|
|
```
|
|
$ go test -count=1 -v ./apps/edge/... ./apps/node/...
|
|
? iop/apps/edge/cmd/edge [no test files]
|
|
? iop/apps/edge/internal/bootstrap [no test files]
|
|
=== RUN TestRegistry_RegisterAndCount
|
|
--- PASS: TestRegistry_RegisterAndCount (0.00s)
|
|
=== RUN TestRegistry_Pick_Empty
|
|
--- PASS: TestRegistry_Pick_Empty (0.00s)
|
|
=== RUN TestRegistry_Unregister
|
|
--- PASS: TestRegistry_Unregister (0.00s)
|
|
PASS
|
|
ok iop/apps/edge/internal/node 0.265s
|
|
=== RUN TestEdgeServerIntegration
|
|
--- PASS: TestEdgeServerIntegration (0.03s)
|
|
PASS
|
|
ok iop/apps/edge/internal/transport 0.807s
|
|
? iop/apps/node/cmd/node [no test files]
|
|
? iop/apps/node/internal/adapters [no test files]
|
|
? iop/apps/node/internal/adapters/cli [no test files]
|
|
? iop/apps/node/internal/adapters/mock [no test files]
|
|
? iop/apps/node/internal/adapters/ollama [no test files]
|
|
? iop/apps/node/internal/adapters/vllm [no test files]
|
|
? iop/apps/node/internal/bootstrap [no test files]
|
|
=== RUN TestOnCapabilityRequest
|
|
--- PASS: TestOnCapabilityRequest (0.00s)
|
|
=== RUN TestOnRunRequest_RouterError
|
|
--- PASS: TestOnRunRequest_RouterError (0.00s)
|
|
=== RUN TestOnRunRequest_AdapterNotFound
|
|
--- PASS: TestOnRunRequest_AdapterNotFound (0.00s)
|
|
=== RUN TestOnRunRequest_Success
|
|
--- PASS: TestOnRunRequest_Success (0.00s)
|
|
=== RUN TestOnCancel_CallsCancelFn
|
|
--- PASS: TestOnCancel_CallsCancelFn (0.00s)
|
|
PASS
|
|
ok iop/apps/node/internal/node 1.299s
|
|
? iop/apps/node/internal/router [no test files]
|
|
? iop/apps/node/internal/runtime [no test files]
|
|
? iop/apps/node/internal/store [no test files]
|
|
=== RUN TestNodeParserMap_RunRequest
|
|
--- PASS: TestNodeParserMap_RunRequest (0.00s)
|
|
=== RUN TestNodeParserMap_CancelRequest
|
|
--- PASS: TestNodeParserMap_CancelRequest (0.00s)
|
|
=== RUN TestNodeParserMap_CapabilityRequest
|
|
--- PASS: TestNodeParserMap_CapabilityRequest (0.00s)
|
|
=== RUN TestNodeClientIntegration
|
|
--- PASS: TestNodeClientIntegration (0.10s)
|
|
=== RUN TestSession_RegisterCancel_CancelRun
|
|
--- PASS: TestSession_RegisterCancel_CancelRun (0.00s)
|
|
=== RUN TestSession_DeregisterCancel
|
|
--- PASS: TestSession_DeregisterCancel (0.00s)
|
|
=== RUN TestSession_CancelRun_UnknownID
|
|
--- PASS: TestSession_CancelRun_UnknownID (0.00s)
|
|
=== RUN TestSession_ConcurrentRegisterCancel
|
|
--- PASS: TestSession_ConcurrentRegisterCancel (0.00s)
|
|
PASS
|
|
ok iop/apps/node/internal/transport 1.367s
|
|
```
|
|
|
|
## 코드리뷰 결과
|
|
|
|
- **종합 판정**: `PASS`
|
|
- **차원별 평가**:
|
|
- Correctness: Pass
|
|
- Completeness: Pass
|
|
- Test coverage: Pass
|
|
- API contract: Pass
|
|
- Code quality: Pass
|
|
- Plan deviation: Pass (internal 패키지 정책에 맞춘 분리 구현은 타당함)
|
|
- Verification trust: Pass
|
|
- **발견된 문제**: 없음
|
|
- **다음 단계**: PASS (완료)
|