fix monitor desktop task recovery
This commit is contained in:
@@ -245,6 +245,27 @@ func TestRequeueExpiredMonitorDesktopTasksSQLReturnsTaskToQueue(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestAbortExpiredMonitorDesktopTasksSQLTerminatesUnrecoverableTask(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
normalized := normalizeSQLForDesktopTaskTest(abortExpiredMonitorDesktopTasksSQL())
|
||||
for _, fragment := range []string{
|
||||
"SET status = 'aborted'",
|
||||
"active_attempt_id = NULL",
|
||||
"lease_token_hash = NULL",
|
||||
"lease_expires_at = NULL",
|
||||
"interrupt_reason = COALESCE(interrupt_reason, $3)",
|
||||
"WHERE desktop_id = ANY($1::uuid[])",
|
||||
"AND kind = 'monitor'",
|
||||
"AND status = 'in_progress'",
|
||||
"RETURNING desktop_id",
|
||||
} {
|
||||
if !strings.Contains(normalized, fragment) {
|
||||
t.Fatalf("expired monitor abort query missing %q: %s", fragment, normalized)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestClassifyLeaseErrorDefersQueuedMonitorTask(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user