Something went wrong. Try again.
A Kubernetes operator that runs Claude Code sessions on long-horizon work
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940package operator_test
import ( "testing" "testing/synctest" "time"
"tangled.org/guid.foo/simmer/api/v1alpha1" "tangled.org/guid.foo/simmer/dataplane" "tangled.org/guid.foo/simmer/internal/world")
// The agent's own close of its issue wakes no one, and still frees the// issue's key, so the Session finishes after the turn that closed it.func TestASessionFinishesWhenItsAgentReleasesItsKeyInAnIgnoredEvent(t *testing.T) { synctest.Test(t, func(t *testing.T) { alerts := world.Signal("alerts") alerts.Spec.Ignore = `.sender == "agent"` account := world.Account("personal") account.Status.Usage = world.Reading(0.1, 0.01, time.Now().Add(84*time.Hour), time.Now()) r := startServing(t, account, ops(), alerts, stream( `{"status":"firing","labels":{"alertname":"DiskFull","namespace":"assistant"}}`, `{"status":"resolved","sender":"agent","labels":{"alertname":"DiskFull","namespace":"assistant"}}`, ), triage())
r.pass(t) r.pass(t) s := r.only(t) inbox := r.store.Inbox(dataplane.SessionRef{Namespace: "telemetry", Name: s.Metadata.Name}) _, _ = r.store.Take(dataplane.SessionRef{Namespace: "telemetry", Name: s.Metadata.Name}, len(inbox)) r.succeed(t, s.Metadata.Name+"-1") r.pass(t)
s = r.only(t) if len(inbox) != 1 || s.Status.Phase != v1alpha1.PhaseFinished { t.Errorf("%d in the inbox and status %+v, want the firing alert only and Finished", len(inbox), s.Status) } })}