Something went wrong. Try again.
small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637package cli
import ( "context" "net/http" "strings" "testing" "testing/synctest" "time"
"albedo/cli/internal/daemon")
type stalledPhotonStatus struct{ attempts int }
func (s *stalledPhotonStatus) RoundTrip(req *http.Request) (*http.Response, error) { s.attempts++ <-req.Context().Done() return nil, req.Context().Err()}
func TestPhotonSetupDeadlineDuringStatusRead(t *testing.T) { synctest.Test(t, func(t *testing.T) { conn := daemon.NewConnection(daemon.ConnectionSnapshot{Port: 12345}, nil) transport := &stalledPhotonStatus{} conn.HTTPClient().Transport = transport start := time.Now() err := waitForPhoton(context.Background(), conn, photonPairing{Session: "paired"}) if err == nil || !strings.Contains(err.Error(), "albedo photon status") { t.Fatalf("expected instructions for checking the saved pairing, got %v", err) } if transport.attempts < 2 || time.Since(start) != 30*time.Second { t.Fatalf("readiness wait ended after %d attempts in %s", transport.attempts, time.Since(start)) } })}