Skip to content
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

RUBY-3571 Add TransientTransactionError label to PoolClearedError #2906

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading