Update pkg/agent/loop_test.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
753b5d981f
commit
04411bd55d
1 changed files with 12 additions and 5 deletions
|
|
@ -2166,15 +2166,22 @@ func TestProcessHeartbeat_RunsWhenIdle(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ProcessHeartbeat should proceed (not return early with HEARTBEAT_OK skip)
|
// ProcessHeartbeat should proceed (not return early with HEARTBEAT_OK skip)
|
||||||
// It will either succeed or fail depending on agent setup, but it should NOT
|
// and, with the mock provider used in newTestAgentLoop, return a deterministic
|
||||||
// return the skip sentinel.
|
// mock response.
|
||||||
resp, err := al.ProcessHeartbeat(context.Background(), "heartbeat prompt", "cli", "direct")
|
resp, err := al.ProcessHeartbeat(context.Background(), "heartbeat prompt", "cli", "direct")
|
||||||
|
|
||||||
// With no default agent registered, it returns an error — that's fine,
|
// Must not skip due to busy check.
|
||||||
// the point is it didn't skip due to busy check.
|
if resp == "HEARTBEAT_OK" {
|
||||||
if err != nil && resp == "HEARTBEAT_OK" {
|
|
||||||
t.Fatal("ProcessHeartbeat skipped despite no active turns")
|
t.Fatal("ProcessHeartbeat skipped despite no active turns")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Given the mock provider, the heartbeat call should succeed with a fixed response.
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("expected no error from ProcessHeartbeat when idle, got: %v", err)
|
||||||
|
}
|
||||||
|
if resp != "Mock response" {
|
||||||
|
t.Fatalf("expected mock provider response %q, got %q", "Mock response", resp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestProcessHeartbeat_SkipsForAnyActiveSession(t *testing.T) {
|
func TestProcessHeartbeat_SkipsForAnyActiveSession(t *testing.T) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue