Update agent-run tests for lease-free worker

Drop the lease, heartbeat, and stale-recovery test coverage that no
longer applies, and add coverage for the new behaviour: graceful
suspend returning a run to PENDING, an approval interruption parking it
in AWAITING_APPROVAL, and SubmitApproval merging decisions and
requeuing the run. Exercise the submitAgentRunApproval mutation end to
end, including the authorization paths for the relocated policies.

Signed-off-by: Bryan Frimin <bryan@probo.com>
This commit is contained in:
Bryan Frimin
2026-06-08 14:51:37 +02:00
parent c14bacb157
commit c366074d70
5 changed files with 503 additions and 147 deletions

View File

@@ -93,7 +93,6 @@ func newTestWorker(
baseOpts := []agentrun.WorkerOption{
agentrun.WithWorkerInterval(250 * time.Millisecond),
agentrun.WithWorkerLeaseDuration(30 * time.Second),
}
baseOpts = append(baseOpts, opts...)
@@ -276,7 +275,6 @@ func resetRunToPending(t *testing.T, client *pg.Client, runID gid.GID) {
`UPDATE agent_runs
SET status = 'PENDING',
started_at = NULL,
lease_expires_at = NULL,
updated_at = now()
WHERE id = $1`,
runID.String(),
@@ -314,24 +312,3 @@ func overwriteRunInputMessagesRaw(
)
require.NoError(t, err)
}
func bumpRunLeaseGeneration(t *testing.T, client *pg.Client, runID gid.GID) {
t.Helper()
err := client.WithConn(
context.Background(),
func(ctx context.Context, conn pg.Querier) error {
_, err := conn.Exec(
ctx,
`UPDATE agent_runs
SET lease_generation = lease_generation + 1,
updated_at = now()
WHERE id = $1`,
runID.String(),
)
return err
},
)
require.NoError(t, err)
}