Skip to content

Commit 098b505

Browse files
author
gastown/crew/max
committed
fix(test): scheduler tests look for sling context across all rig dirs
After dee628d moved gt sling's sling-context creation from HQ to the target rig's beads dir, the scheduler integration test helpers still looked only at HQ. findSlingContext and the inline ListOpenSlingContexts check in TestSchedulerSlingContextIdempotency now iterate all rig dirs via listAllSlingContexts, matching what production code does. Fixes TestSchedulerAutoConvoyCreation, TestSchedulerSlingContextIdempotency, TestSchedulerMultiRigEpicAutoResolve, TestSchedulerMultiRigConvoyAutoResolve.
1 parent 242bb11 commit 098b505

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

internal/cmd/scheduler_integration_test.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -209,19 +209,23 @@ func createSlingContext(t *testing.T, hqPath string, fields *capacity.SlingConte
209209
return ctxBead.ID
210210
}
211211

212-
// findSlingContext finds an open sling context for a work bead in the HQ beads DB.
212+
// findSlingContext finds an open sling context for a work bead by scanning all
213+
// rig beads dirs under townRoot. Mirrors production's listAllSlingContexts since
214+
// sling contexts now live in the target rig's beads dir, not HQ (see dee628d3).
213215
// Returns nil if none found.
214216
func findSlingContext(t *testing.T, hqPath, workBeadID string) *capacity.SlingContextFields {
215217
t.Helper()
216-
townBeads := beads.NewWithBeadsDir(hqPath, filepath.Join(hqPath, ".beads"))
217-
_, fields, err := townBeads.FindOpenSlingContext(workBeadID)
218-
if err != nil {
219-
t.Fatalf("FindOpenSlingContext(%s) failed: %v", workBeadID, err)
218+
for _, ctx := range listAllSlingContexts(hqPath) {
219+
fields := beads.ParseSlingContextFields(ctx.Description)
220+
if fields != nil && fields.WorkBeadID == workBeadID {
221+
return fields
222+
}
220223
}
221-
return fields
224+
return nil
222225
}
223226

224-
// hasSlingContext checks if a work bead has an open sling context in HQ.
227+
// hasSlingContext checks if a work bead has an open sling context anywhere
228+
// under townRoot (HQ or any rig beads dir).
225229
func hasSlingContext(t *testing.T, hqPath, workBeadID string) bool {
226230
t.Helper()
227231
return findSlingContext(t, hqPath, workBeadID) != nil
@@ -456,14 +460,10 @@ func TestSchedulerSlingContextIdempotency(t *testing.T) {
456460
slingToScheduler(t, gtBinary, hqPath, env, beadID, "testrig")
457461
slingToScheduler(t, gtBinary, hqPath, env, beadID, "testrig")
458462

459-
// Verify: only one sling context exists
460-
townBeads := beads.NewWithBeadsDir(hqPath, filepath.Join(hqPath, ".beads"))
461-
contexts, err := townBeads.ListOpenSlingContexts()
462-
if err != nil {
463-
t.Fatalf("ListOpenSlingContexts failed: %v", err)
464-
}
463+
// Verify: only one sling context exists across all rig dirs
464+
// (sling contexts live in the target rig's beads dir per dee628d3).
465465
count := 0
466-
for _, ctx := range contexts {
466+
for _, ctx := range listAllSlingContexts(hqPath) {
467467
fields := beads.ParseSlingContextFields(ctx.Description)
468468
if fields != nil && fields.WorkBeadID == beadID {
469469
count++

0 commit comments

Comments
 (0)