Something went wrong. Try again.
A Kubernetes operator that runs Claude Code sessions on long-horizon work
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243package operator_test
import ( "testing" "testing/synctest"
"tangled.org/guid.foo/simmer/cluster" "tangled.org/guid.foo/simmer/dataplane")
// The pass creates turn 2's Job and fails to write the status that// records it. The turn still takes its events under 2, the number that// the pass acknowledges them by when its Job succeeds.func TestATurnWhoseRecordWasLostTakesItsEventsUnderItsJobsNumber(t *testing.T) { synctest.Test(t, func(t *testing.T) { r := start(t) r.pass(t) r.pass(t) s := r.only(t) ref := dataplane.SessionRef{Namespace: "telemetry", Name: s.Metadata.Name} _, _ = r.store.Take(ref, 1) r.succeed(t, s.Metadata.Name+"-1") r.pass(t) _ = r.store.Deliver(ref, dataplane.Event{ID: "second"}) r.pass(t) lost := r.only(t) lost.Status.Turns = lost.Status.Turns[:1] lost.Status.TurnCount = 1 r.w.Put(cluster.Sessions, &lost) synctest.Wait()
turn, err := r.o.Turn(t.Context(), ref) _, _ = r.store.Take(ref, turn.Number) r.pass(t) r.succeed(t, s.Metadata.Name+"-2") r.pass(t)
if pending, _ := r.store.Pending(ref); err != nil || turn.Number != 2 || pending != 0 { t.Errorf("turn %d, %v, and %d events wait after it succeeded; want turn 2 and none", turn.Number, err, pending) } })}