Sha256: 1a05edc485c4d678ecef3b65034e1d98af04fdebd18016f4dfc393e8670fd92a

Contents?: true

Size: 955 Bytes

Versions: 6

Compression:

Stored size: 955 Bytes

Contents

require 'spec_helper'

describe 'Retryable writes errors tests' do
  describe 'when the storage engine does not support retryable writes but the server does' do
    require_mmapv1
    min_server_fcv '3.6'
    require_topology :replica_set, :sharded

    before do
      collection.delete_many
    end

    let(:collection) do
      client[authorized_collection.name]
    end

    let(:client) do
      authorized_client.with(retry_writes: true)
    end

    after do
      client.close(true)
    end

    context 'when a retryable write is attempted' do
      it 'raises an actionable error message' do
        expect {
          collection.insert_one(a:1)
        }.to raise_error(Mongo::Error::OperationFailure, /This MongoDB deployment does not support retryable writes. Please add retryWrites=false to your connection string or use the retry_writes: false Ruby client option/)
        expect(collection.find.count).to eq(0)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mongo-2.10.5 spec/integration/retryable_writes_errors_spec.rb
mongo-2.10.4 spec/integration/retryable_writes_errors_spec.rb
mongo-2.10.3 spec/integration/retryable_writes_errors_spec.rb
mongo-2.10.2 spec/integration/retryable_writes_errors_spec.rb
mongo-2.10.1 spec/integration/retryable_writes_errors_spec.rb
mongo-2.10.0 spec/integration/retryable_writes_errors_spec.rb