File: error_detection_spec.rb

package info (click to toggle)
ruby-mongo 2.21.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 14,764 kB
  • sloc: ruby: 108,806; makefile: 5; sh: 2
file content (42 lines) | stat: -rw-r--r-- 876 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# frozen_string_literal: true
# rubocop:todo all

require 'spec_helper'

describe 'Error detection' do
  context 'document contains a not master/node recovering code' do
    let(:document) { {code: 91} }

    let(:coll) { authorized_client_without_any_retries['error-detection'] }

    before do
      coll.delete_many
    end

    context 'cursors not used' do

      before do
        coll.insert_one(document)
      end

      it 'is not treated as an error when retrieved' do
        actual = coll.find.first
        expect(actual['code']).to eq(91)
      end
    end

    context 'cursors used' do

      before do
        10.times do
          coll.insert_one(document)
        end
      end

      it 'is not treated as an error when retrieved' do
        actual = coll.find({}, batch_size: 2).first
        expect(actual['code']).to eq(91)
      end
    end
  end
end