v0.289.1: strip the provider rclone notice; an unreadable snapshot count is never a measured zero (found live on demo-felhom)
gates / gates (push) Successful in 29s
gates / gates (push) Successful in 29s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
@@ -235,3 +235,34 @@ func TestAbandon_PinnedDefersToOperator(t *testing.T) {
|
||||
t.Fatal("second sweep deleted")
|
||||
}
|
||||
}
|
||||
|
||||
// The provider's rclone notice must not reach a JSON parser — measured live on demo-felhom (v0.289.0).
|
||||
func TestStripRcloneNotice(t *testing.T) {
|
||||
in := "rclone: 2026/10/03 15:05:42 NOTICE: Config file \"/home/.config/rclone/rclone.conf\" not found - using defaults\n[{\"id\":\"s1\"}]\n"
|
||||
if got := string(stripRcloneNotice([]byte(in))); got != "[{\"id\":\"s1\"}]\n" {
|
||||
t.Fatalf("got %q", got)
|
||||
}
|
||||
keep := "rclone: 2026/10/03 15:05:42 ERROR : something real\n"
|
||||
if got := string(stripRcloneNotice([]byte(keep))); got != keep {
|
||||
t.Fatalf("an rclone ERROR line was stripped: %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
// THE CONSEQUENCE (R-331/R-431): a run whose snapshot listing cannot be read must NOT record 0 as a
|
||||
// measurement. Before the fix the box reported 0 snapshots with stats_known over a store holding 12.
|
||||
func TestRunOffbox_UnreadableCountIsNotZero(t *testing.T) {
|
||||
m, sett := newOffboxManager(t)
|
||||
sett.UpdateOffboxStatus(func(o *settings.OffboxTarget) { o.SnapshotCount, o.StatsKnown = 11, true })
|
||||
m.SetOffboxRunner(func(ctx context.Context, env []string, args ...string) ([]byte, error) {
|
||||
if contains(args, "snapshots") {
|
||||
return []byte("rclone: 2026/10/03 15:05:42 ERROR : boom\nnot json"), nil
|
||||
}
|
||||
rr := &recordingOffboxRunner{}
|
||||
return rr.run(ctx, env, args...)
|
||||
})
|
||||
_ = m.RunOffboxBackup(context.Background())
|
||||
got := sett.GetOffboxTarget()
|
||||
if got.StatsKnown && got.SnapshotCount == 0 {
|
||||
t.Fatalf("an unreadable count was recorded as a measured zero: %+v", got.SnapshotCount)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user