Add input validation to the Append RPC handler (session_id, agent_id, action, context.session_id) and create a full integration test suite that spins up real gRPC servers to test the complete request/response flow including hash chain integrity and concurrent access. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1.5 KiB
1.5 KiB
Implementation Plan — Issue #21: Integration tests for Audit Service
Metadata
| Field | Value |
|---|---|
| Issue | #21 |
| Title | Integration tests for Audit Service |
| Milestone | Phase 2: Audit Service |
| Labels | type:testing, priority:high, lang:rust, service:audit |
| Status | COMPLETED |
| Language | Rust |
| Related Plans | issue-020.md |
| Blocked by | #20 (completed) |
Acceptance Criteria
- Integration tests that start a real gRPC server and test via client
- Test successful append flow with file verification
- Test all validation error paths over gRPC
- Test hash chain integrity over multiple appends
- Test concurrent client access
- All tests pass with cargo test
Architecture Analysis
Created integration test suite at services/audit/tests/integration_test.rs that:
- Spins up a real tonic gRPC server on a random port per test
- Creates a real
AuditLogWriterbacked by a temp file - Connects a gRPC client and exercises the full request/response flow
- Verifies file contents (JSON lines, hash chain) after writes
- Tests concurrent access from multiple spawned clients
Files to Create/Modify
| File | Action | Purpose |
|---|---|---|
services/audit/tests/integration_test.rs |
Create | 9 integration tests covering full gRPC flow |
services/audit/Cargo.toml |
Modify | Add tokio-stream and serde_json dev dependencies |
Deviation Log
(No deviations)