Pass the state-file flush to a subscription in its options
A subscription flushed its state file through a package variable, which the ntfy tests replaced with a no-op in their TestMain. Tests in other packages could not reach it, so the daemon's own tests still flushed for real. Options.Sync now takes the flush; nil means (*os.File).Sync, as before. The ntfy tests pass a no-op through their options and to saveState. Behaviour is unchanged. docs/plans/ntfy.md names the option, and its line references follow the code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c548833656
commit
62e5ec9c66
9 files changed
+49
-49
No files matched your search
@@ -179,7 +179,7 @@ func TestStaleCursorReplaysUnclamped(t *testing.T) {
|
||||
f := newFakeServer()
|
||||
o := testOptions(f, dir)
|
||||
old := f.publish(Message{Title: "three hours ago"})
|
||||
if err := saveState(o.StateFile, state{Cursor: old.Time}); err != nil {
|
||||
if err := saveState(o.StateFile, state{Cursor: old.Time}, skipSync); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
time.Sleep(3 * time.Hour)
|
||||
@@ -213,7 +213,7 @@ func TestBacklogFloorIsSaved(t *testing.T) {
|
||||
f := newFakeServer()
|
||||
o := testOptions(f, t.TempDir())
|
||||
o.MaxBacklog = 2 * time.Minute
|
||||
if err := saveState(o.StateFile, state{Cursor: time.Now().Unix()}); err != nil {
|
||||
if err := saveState(o.StateFile, state{Cursor: time.Now().Unix()}, skipSync); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
time.Sleep(time.Second)
|
||||
|
||||
Reference in new issue
Block a user