Paper trading readiness에서 API/worker/CLI가 같은 protobuf 계약으로 paper state를 시작하고 조회할 수 있어야 한다. Headless 운영 경로를 먼저 닫기 위해 contract, worker runtime, API forwarding, CLI scenario, client parser map과 검증 artifact를 함께 반영한다.
40 lines
1.4 KiB
Go
40 lines
1.4 KiB
Go
package main
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"git.toki-labs.com/toki/alt/services/worker/internal/jobs"
|
|
"git.toki-labs.com/toki/alt/services/worker/internal/storage/postgres"
|
|
)
|
|
|
|
// TestStoreBackedDepsWiresBacktestSurfaces guards against a regression where the
|
|
// worker process serves backtest reads but leaves the start surface (Starter)
|
|
// unwired, which would advertise no backtest-start capability and reject every
|
|
// start command. The store is built with a nil pool because the wiring path only
|
|
// constructs adapters; it never touches the database at startup.
|
|
func TestStoreBackedDepsWiresBacktestSurfaces(t *testing.T) {
|
|
runner := jobs.NewRunner()
|
|
deps := storeBackedDeps(runner, postgres.NewStore(nil))
|
|
|
|
if deps.Starter == nil {
|
|
t.Error("expected backtest Starter to be wired")
|
|
}
|
|
if deps.Analysis == nil || deps.Results == nil {
|
|
t.Error("expected backtest read stores to be wired")
|
|
}
|
|
if deps.Instruments == nil || deps.Bars == nil {
|
|
t.Error("expected market stores to be wired")
|
|
}
|
|
if deps.DailyBarImporter == nil {
|
|
t.Error("expected daily bar importer to be wired")
|
|
}
|
|
if deps.Paper == nil {
|
|
t.Error("expected paper trading service to be wired")
|
|
}
|
|
|
|
// Wiring registers the import and run-backtest job handlers on the runner, so
|
|
// it must hold at least those two handlers after wiring.
|
|
if runner.Len() < 2 {
|
|
t.Errorf("expected wiring to register job handlers, runner holds %d", runner.Len())
|
|
}
|
|
}
|