mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-23 05:05:54 +00:00
@@ -29,11 +29,9 @@ using namespace data::cassandra;
|
||||
using namespace data::cassandra::detail;
|
||||
using namespace testing;
|
||||
|
||||
class BackendCassandraAsyncExecutorTest : public SyncAsioContextTest
|
||||
{
|
||||
class BackendCassandraAsyncExecutorTest : public SyncAsioContextTest {
|
||||
protected:
|
||||
struct CallbackMock
|
||||
{
|
||||
struct CallbackMock {
|
||||
MOCK_METHOD(void, onComplete, (FakeResultOrError));
|
||||
MOCK_METHOD(void, onRetry, ());
|
||||
};
|
||||
@@ -64,7 +62,8 @@ TEST_F(BackendCassandraAsyncExecutorTest, CompletionCalledOnSuccess)
|
||||
callbackMock_.onComplete(std::move(resultOrError));
|
||||
work.reset();
|
||||
},
|
||||
std::move(onRetry_));
|
||||
std::move(onRetry_)
|
||||
);
|
||||
|
||||
ctx.run();
|
||||
}
|
||||
@@ -78,12 +77,9 @@ TEST_F(BackendCassandraAsyncExecutorTest, ExecutedMultipleTimesByRetryPolicyOnMa
|
||||
ON_CALL(handle, asyncExecute(An<FakeStatement const&>(), An<std::function<void(FakeResultOrError)>&&>()))
|
||||
.WillByDefault([&callCount](auto const&, auto&& cb) {
|
||||
++callCount;
|
||||
if (callCount >= 3)
|
||||
{
|
||||
if (callCount >= 3) {
|
||||
cb({});
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
cb({CassandraError{"timeout", CASS_ERROR_LIB_REQUEST_TIMED_OUT}});
|
||||
}
|
||||
|
||||
@@ -104,7 +100,8 @@ TEST_F(BackendCassandraAsyncExecutorTest, ExecutedMultipleTimesByRetryPolicyOnMa
|
||||
callbackMock_.onComplete(std::move(resultOrError));
|
||||
work.reset();
|
||||
},
|
||||
std::move(onRetry_));
|
||||
std::move(onRetry_)
|
||||
);
|
||||
|
||||
ctx.run();
|
||||
ASSERT_EQ(callCount, 3);
|
||||
@@ -123,12 +120,9 @@ TEST_F(BackendCassandraAsyncExecutorTest, ExecutedMultipleTimesByRetryPolicyOnOt
|
||||
ON_CALL(handle, asyncExecute(An<FakeStatement const&>(), An<std::function<void(FakeResultOrError)>&&>()))
|
||||
.WillByDefault([&callCount](auto const&, auto&& cb) {
|
||||
++callCount;
|
||||
if (callCount >= 3)
|
||||
{
|
||||
if (callCount >= 3) {
|
||||
cb({});
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
cb({CassandraError{"timeout", CASS_ERROR_LIB_REQUEST_TIMED_OUT}});
|
||||
}
|
||||
|
||||
@@ -150,7 +144,8 @@ TEST_F(BackendCassandraAsyncExecutorTest, ExecutedMultipleTimesByRetryPolicyOnOt
|
||||
work.reset();
|
||||
work2.reset();
|
||||
},
|
||||
std::move(onRetry_));
|
||||
std::move(onRetry_)
|
||||
);
|
||||
|
||||
ctx.run();
|
||||
EXPECT_EQ(callCount, 3);
|
||||
@@ -187,7 +182,8 @@ TEST_F(BackendCassandraAsyncExecutorTest, CompletionCalledOnFailureAfterRetryCou
|
||||
callbackMock_.onComplete(std::move(res));
|
||||
work.reset();
|
||||
},
|
||||
std::move(onRetry_));
|
||||
std::move(onRetry_)
|
||||
);
|
||||
|
||||
ctx.run();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user