diff --git a/cmd/codeaf/hosted_takeback_test.go b/cmd/codeaf/hosted_takeback_test.go index 993a2cef0b..3eef5ae626 100644 --- a/cmd/codeaf/hosted_takeback_test.go +++ b/cmd/codeaf/hosted_takeback_test.go @@ -15,6 +15,7 @@ import ( "os" "os/exec" "path/filepath" + "runtime" "slices" "strings" "sync" @@ -67,7 +68,14 @@ func (m moveRenewals) RenewalChanges() <-chan struct{} { return m.changes } func newHostedMoveRig(t *testing.T, wrap ...func(http.Handler) http.Handler) *hostedMoveRig { t.Helper() cfg, c := doorChat(t) - short, err := os.MkdirTemp("", "cf-move-") + // The workspace host's socket lives under this home. macOS's temporary + // folder leaves it only a few bytes under the socket limit, and none once + // that folder is spelled through /private, so Unix homes start at /tmp. + base := "" + if runtime.GOOS != "windows" { + base = "/tmp" + } + short, err := os.MkdirTemp(base, "cf-move-") if err != nil { t.Fatal(err) } diff --git a/docs/changes/unreleased/2032-sync-engine-fixtures.md b/docs/changes/unreleased/2032-sync-engine-fixtures.md new file mode 100644 index 0000000000..49cdb18f55 --- /dev/null +++ b/docs/changes/unreleased/2032-sync-engine-fixtures.md @@ -0,0 +1,5 @@ +--- +kind: internal +title: Sync fixtures keep their socket homes short on macOS and wait for branch publication +pr: 2032 +--- diff --git a/internal/syncsetup/drive_test.go b/internal/syncsetup/drive_test.go index 195bb77478..8cab8d45a4 100644 --- a/internal/syncsetup/drive_test.go +++ b/internal/syncsetup/drive_test.go @@ -498,6 +498,16 @@ func TestDriveSideStartsAsViewerWhenHeld(t *testing.T) { // daemon's socket appearing shows the daemon, and not the spawn, served them. func TestDriveSidePublishesOverTheDefaultDaemon(t *testing.T) { r := newDriveRig(t) + if runtime.GOOS != "windows" { + // The rig has not opened an engine transport yet. A short home keeps + // its socket inside the home even with macOS's small address limit. + short, err := os.MkdirTemp("/tmp", "cds") + if err != nil { + t.Fatal(err) + } + t.Cleanup(func() { _ = os.RemoveAll(short) }) + t.Setenv(home.EnvVar, short) + } t.Setenv("CODEAF_ENGINE_DAEMON", "") r.engine.Transport = nil t.Cleanup(func() { stopDaemons(t) }) diff --git a/internal/syncsetup/twohomes_test.go b/internal/syncsetup/twohomes_test.go index e7c33fa0a3..082cae3369 100644 --- a/internal/syncsetup/twohomes_test.go +++ b/internal/syncsetup/twohomes_test.go @@ -493,6 +493,10 @@ func TestTwoHomesL12DeathBranches(t *testing.T) { h.block.set(false) waitFor(t, "A to learn it was superseded", func() bool { _, viewer := a.drive.Viewer(); return viewer }) + waitFor(t, "A's branch row to hold three orphan turns", func() bool { + branch, ok := branchRowOf(t, h.a, h.cell.ID) + return ok && branch.OrphanTurns == 3 + }) v, err := h.a.Dir.Cell(ctx, h.cell.ID) if err != nil || v.Cell.Head != parentHead || v.Cell.Lease.Device != h.b.Device.ID() {