Skip to content

Commit b7ca3bd

Browse files
committed
refactor(api): access orchestrator through an interface
APIStore held the concrete *orchestrator.Orchestrator, which cannot be constructed in a unit test, so handler paths that call the orchestrator (the snapshot fallbacks in get/connect/resume) were untestable. Introduce a sandboxOrchestrator interface (composed of focused sandboxOps and node role interfaces) covering the methods the handlers use, and hold it on APIStore. A compile-time assertion keeps the concrete type in sync, and mockery generates a mock for handler tests. No behavior change.
1 parent 6b8bf29 commit b7ca3bd

4 files changed

Lines changed: 1221 additions & 1 deletion

File tree

.mockery.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,9 @@ packages:
9292
filename: mockfeatureflagsclient.go
9393
pkgname: handlersmocks
9494
structname: MockFeatureFlagsClient
95+
sandboxOrchestrator:
96+
config:
97+
dir: packages/api/internal/handlers/mocks
98+
filename: mocksandboxorchestrator.go
99+
pkgname: handlersmocks
100+
structname: MockSandboxOrchestrator

0 commit comments

Comments
 (0)