-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
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.