Skip to content

Commit 81374ff

Browse files
committed
Expect a cancelling waiting Turn to keep its actions
1 parent 26ff782 commit 81374ff

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎services/core/internal/persistence/postgres/sessionpg/functions_test.go‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,12 @@ func TestLoadRequiredActionsReadsPendingCalls(t *testing.T) {
206206
t.Fatal(string(encoded), err)
207207
}
208208
exec(t, pool, `UPDATE turns SET cancel_requested_at = clock_timestamp() WHERE id = $1`, f.turn)
209-
// The Turn as the caller read it still waits; the read of its calls sees
210-
// the requested cancellation.
211-
if actions, err := LoadRequiredActions(t.Context(), q, f.session, TurnFromRow(row)); err != nil || actions == nil || len(actions) != 0 {
209+
// A waiting Turn keeps its actions until it ends, also after a cancellation request.
210+
row, err = q.GetTurn(t.Context(), sqlc.GetTurnParams{TenantID: f.tenant, SessionID: f.session, ID: f.turn})
211+
if err != nil {
212+
t.Fatal(err)
213+
}
214+
if actions, err := LoadRequiredActions(t.Context(), q, f.session, TurnFromRow(row)); err != nil || len(actions) != 2 {
212215
t.Fatalf("cancelling Turn actions %+v %v", actions, err)
213216
}
214217
}

0 commit comments

Comments
 (0)