package main import ( "knowledge-governance/internal/jobs" "knowledge-governance/internal/qaopsmirror" "testing" ) func TestLocalMirrorWorkerRegistrationNeverConnectsSource(t *testing.T) { values := map[string]string{} get := func(k string) string { return values[k] } handlers := map[string]jobs.Handler{} if store, e := configureRecordsSync(nil, get, "postgres://fixture@localhost/local", handlers); e != nil || store != nil || len(handlers) != 0 { t.Fatal("disabled mirror registered") } values["DOBOTAI_OPS_READ_ENABLED"] = "true" values["DOBOTAI_OPS_TENANT_KEY"] = "fixture-worker-tenant" values["DOBOTAI_OPS_READ_DSN_FILE"] = "/nonexistent-fixture-source-secret" store, e := configureRecordsSync(nil, get, "postgres://fixture@localhost/local", handlers) if e != nil || store == nil || handlers[qaopsmirror.NewStore(nil, "fixture-worker-tenant").SyncJobType()] == nil { t.Fatal("local mirror handler missing; registration must not connect to source", e) } }