Sha256: 1f66b729d03ad7a1ccea724f4b49ea3ce06308628617774d9f6d4d6cf080eca6

Contents?: true

Size: 1.5 KB

Versions: 5

Compression:

Stored size: 1.5 KB

Contents

# frozen_string_literal: true
# encoding: utf-8

require 'spec_helper'

require 'runners/crud'

base = "#{CURRENT_PATH}/spec_tests/data/retryable_reads"
RETRYABLE_READS_TESTS = Dir.glob("#{base}/legacy/**/*.yml").sort

describe 'Retryable reads legacy spec tests' do
  require_wired_tiger
  require_no_multi_mongos

  define_crud_spec_tests(RETRYABLE_READS_TESTS) do |spec, req, test|
    let(:client) do
      authorized_client.use(spec.database_name).with({max_read_retries: 0}.update(test.client_options)).tap do |client|
        client.subscribe(Mongo::Monitoring::COMMAND, event_subscriber)
      end
    end
  end
end

describe 'Retryable reads spec tests - legacy' do
  require_no_multi_mongos

  define_crud_spec_tests(RETRYABLE_READS_TESTS) do |spec, req, test|
    let(:client_options) do
      {
        max_read_retries: 1,
        read_retry_interval: 0,
        retry_reads: false,
      }.update(test.client_options)
    end

    let(:client) do
      authorized_client.use(spec.database_name).with(client_options).tap do |client|
        client.subscribe(Mongo::Monitoring::COMMAND, event_subscriber)
      end
    end

    around do |example|
      desc = example.full_description
      # Skip tests that disable modern retryable reads because they expect
      # no retries - and since legacy retryable reads are used, the tests
      # will fail.
      if desc =~/retryReads is false|fails on first attempt/
        skip 'Test not applicable to legacy read retries'
      end
      example.run
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mongo-2.18.3 spec/spec_tests/retryable_reads_spec.rb
mongo-2.18.2 spec/spec_tests/retryable_reads_spec.rb
mongo-2.18.1 spec/spec_tests/retryable_reads_spec.rb
mongo-2.18.0 spec/spec_tests/retryable_reads_spec.rb
mongo-2.18.0.beta1 spec/spec_tests/retryable_reads_spec.rb