Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-2233

Change retryable writes tests to be more aligned with driver exception flows

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 2.13.0.beta1
    • Affects Version/s: None
    • Component/s: Tests
    • Fully Compatible

      Currently retryable writes tests mock the write method on Mongo socket to raise Mongo::Error-derived exceptions. This is problematic for two reasons:

      1. The methods don't actually raise those exceptions - they raise IOError/SystemCallError.
      2. The methods in question also add connection-level diagnostics (IP address references) and these aren't added.

      This ticket proposes to:

      1. Create a helper method which will be under the exception mapper which the tests will mock. This will resolve the second issue in that the diagnostics will be added upstream of the mocked method.
      2. Redo the retryable writes test to separate exception classes being raised and exception classes that are asserted as being exposed from the driver, since these are in fact different. This will resolve the first issue in that the test will be able to raise the exception classes that a driver might genuinely encounter.

      There is still the case of aforementioned write methods being mocked to raise OperationFailure for the convenience of tests but which isn't possible in practice, but this currently is not causing problems so will be left alone.

            Assignee:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: