Skip to content

fix: fix TestAcquireJobWithCancel_Cancel flake #18441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 19, 2025
Merged

fix: fix TestAcquireJobWithCancel_Cancel flake #18441

merged 1 commit into from
Jun 19, 2025

Conversation

sreya
Copy link
Collaborator

@sreya sreya commented Jun 19, 2025

The test was failing because it was checking for context.Canceled using xerrors.Is, but postgres returns a different error ("pq: canceling statement due to user request") when a query is cancelled. This change uses database.IsQueryCanceledError which properly handles both context.Canceled and postgres-specific cancellation errors.

fixes coder/internal#702

@sreya sreya changed the title fix: handle postgres query cancellation in TestAcquireJobWithCancel_C… fix: flake TestAcquireJobWithCancel_Cancel Jun 19, 2025
@sreya sreya changed the title fix: flake TestAcquireJobWithCancel_Cancel fix: fix TestAcquireJobWithCancel_Cancel flake Jun 19, 2025
@sreya sreya requested a review from deansheather June 19, 2025 02:06
…ancel

The test was failing because it was checking for context.Canceled using
xerrors.Is, but postgres returns a different error ("pq: canceling
statement due to user request") when a query is cancelled. This change
uses database.IsQueryCanceledError which properly handles both
context.Canceled and postgres-specific cancellation errors.
@sreya sreya marked this pull request as ready for review June 19, 2025 02:11
@sreya sreya requested review from kylecarbs and removed request for deansheather June 19, 2025 02:39
@sreya sreya merged commit 8b27983 into main Jun 19, 2025
40 checks passed
@sreya sreya deleted the jon/fixjob branch June 19, 2025 02:51
@github-actions github-actions bot locked and limited conversation to collaborators Jun 19, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

flake: TestAcquireJobWithCancel_Cancel
2 participants