Merge commit '52c4d1f' into feat/remote-node

# Conflicts:
#	internal/db/db.go
This commit is contained in:
2026-11-03 23:00:20 -08:00
parent 8d6d73b747
commit 1f35b7eea4
26 changed files with 1414 additions and 78 deletions
+18
View File
@@ -8,6 +8,7 @@ import (
"path/filepath"
"strings"
"testing"
"time"
"github.com/david/knox/internal/db"
)
@@ -345,3 +346,20 @@ func TestHandleBatchSkipsSelfRows(t *testing.T) {
t.Errorf("self rows: want accepted=0 conflict=2, got accepted=%d conflict=%d", out.Accepted, out.Conflict)
}
}
// TestClientPushSurfacesHTTPError: a non-2xx push response must surface as an
// error — silently treating it as accepted=0 would hide a broken sync direction.
func TestClientPushSurfacesHTTPError(t *testing.T) {
a := tmpKnoxDB(t)
seedObs(a, "AAA")
sv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
http.Error(w, "boom", http.StatusInternalServerError)
}))
defer sv.Close()
c := &Client{Addr: sv.URL, Timeout: 5 * time.Second}
if _, err := c.Push(a, map[string]int64{}); err == nil {
t.Fatal("expected push error on HTTP 500, got nil")
}
}