newTaskSyncService builds an AgentJobService wired to the given bus and a throwaway data dir (so the file persister has somewhere to write). Model/config loaders are nil because the task sync paths under test never touch them.
(bus messaging.MessagingClient)
| 26 | // throwaway data dir (so the file persister has somewhere to write). Model/config |
| 27 | // loaders are nil because the task sync paths under test never touch them. |
| 28 | func newTaskSyncService(bus messaging.MessagingClient) *AgentJobService { |
| 29 | tmpDir := GinkgoT().TempDir() |
| 30 | sysState := &system.SystemState{} |
| 31 | sysState.Model.ModelsPath = tmpDir |
| 32 | appConfig := config.NewApplicationConfig( |
| 33 | config.WithDynamicConfigDir(tmpDir), |
| 34 | config.WithContext(context.Background()), |
| 35 | ) |
| 36 | appConfig.SystemState = sysState |
| 37 | |
| 38 | svc := NewAgentJobServiceWithPaths(appConfig, nil, nil, nil, |
| 39 | // Distinct per-replica files so the file persister write-through never |
| 40 | // crosses replicas: convergence here must be proven via the bus alone. |
| 41 | tmpDir+"/tasks.json", tmpDir+"/jobs.json") |
| 42 | svc.SetTaskSyncNATS(bus) |
| 43 | return svc |
| 44 | } |
| 45 | |
| 46 | var _ = Describe("AgentJobService task cross-replica sync", func() { |
| 47 | Describe("two replicas sharing one bus", func() { |
no test coverage detected