Skip to content

Commit

Permalink
RUBY-3571 Add TransientTransactionError label to PoolClearedError (#2906
Browse files Browse the repository at this point in the history
)
  • Loading branch information
comandeo-mongo authored Nov 4, 2024
1 parent 1db1244 commit f8e5583
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,33 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-20.04 ]
ruby: ["2.7", "3.0", "3.1", "3.2"]
mongodb: ["3.6", "4.4", "5.0", "6.0", "7.0"]
ruby: ["2.7", "3.0", "3.1", "3.2", "3.3"]
mongodb: ["4.4", "5.0", "6.0", "7.0", "8.0"]
topology: [replica_set, sharded_cluster]
include:
- os: macos
ruby: "2.7"
mongodb: "5.0"
mongodb: "7.0"
topology: server
- os: macos
ruby: "3.0"
mongodb: "5.0"
mongodb: "7.0"
topology: server
- os: ubuntu-latest
ruby: "2.7"
mongodb: "5.0"
mongodb: "7.0"
topology: server
- os: ubuntu-latest
ruby: "3.1"
mongodb: "5.0"
mongodb: "7.0"
topology: server
- os: ubuntu-latest
ruby: "3.2"
mongodb: "5.0"
mongodb: "7.0"
topology: server
- os: ubuntu-latest
ruby: "3.2"
mongodb: "6.0"
mongodb: "8.0"
topology: replica_set
steps:
- name: repo checkout
Expand Down
1 change: 1 addition & 0 deletions lib/mongo/error/pool_cleared_error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class PoolClearedError < PoolError
#
# @api private
def initialize(address, pool)
add_label('TransientTransactionError')
super(address, pool,
"Connection to #{address} interrupted due to server monitor timeout " +
"(for pool 0x#{pool.object_id})")
Expand Down
17 changes: 17 additions & 0 deletions spec/mongo/error/pool_cleared_error_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

require 'lite_spec_helper'

describe Mongo::Error::PoolClearedError do
describe '#initialize' do
let(:error) do
described_class.new(
instance_double(Mongo::Address), instance_double(Mongo::Server::ConnectionPool)
)
end

it 'appends TransientTransactionError' do
expect(error.labels).to include('TransientTransactionError')
end
end
end

0 comments on commit f8e5583

Please sign in to comment.