azure-sdk-for-cpp
azure-sdk-for-cpp copied to clipboard
Re-write the RetryPolicy unit tests to remove strong coupling with implementation detail which are marked as virtual for mocking
Follow-up from https://github.com/Azure/azure-sdk-for-cpp/pull/5584
Currently the RetryPolicy
has these two methods which are part of its implementation detail and being used in unit tests:
-
ShouldRetryOnResponse
-
ShouldRetryOnTransportFailure
https://github.com/Azure/azure-sdk-for-cpp/blob/ac685055e654b9553219da7656f351fdf16b04eb/sdk/core/azure-core/inc/azure/core/http/policies/policy.hpp#L405-L417
These methods don't need to be virtual nor are they part of the public surface area. However, the way the tests are written, they take a dependency on this implementation detail. Additionally, because the unit tests have them mocked, they have to be marked as virtual, which they shouldn't be.
https://github.com/Azure/azure-sdk-for-cpp/blob/ac685055e654b9553219da7656f351fdf16b04eb/sdk/core/azure-core/test/ut/retry_policy_test.cpp#L107-L126