| 1 | package control |
| 2 | |
| 3 | import ( |
| 4 | "context" |
| 5 | "os" |
| 6 | "testing" |
| 7 | |
| 8 | "reasonix/internal/session" |
| 9 | ) |
| 10 | |
| 11 | // Round-count semantics must not depend on hundreds of host fsync latencies. |
| 12 | // Failure/restart tests separately exercise real durable writes and recovery. |
| 13 | func goalRoundTestService(t *testing.T) *session.Service { |
| 14 | t.Helper() |
| 15 | store, err := session.CreateWithOptions(t.TempDir()+"/goal-unlimited", "goal-unlimited", session.OpenOptions{ |
| 16 | ExternalHistory: true, |
| 17 | DisableRecoveryPublish: true, |
| 18 | Sync: func(*os.File) error { return nil }, |
| 19 | }) |
| 20 | if err != nil { |
| 21 | t.Fatal(err) |
| 22 | } |
| 23 | service, err := session.NewService("desktop", failingFlushPersistence{session: store}) |
| 24 | if err != nil { |
| 25 | t.Fatal(err) |
| 26 | } |
| 27 | t.Cleanup(func() { _ = service.CloseAll(context.Background()) }) |
| 28 | return service |
| 29 | } |
| 30 |