mirror of
https://github.com/XRPLF/clio.git
synced 2025-12-06 17:27:58 +00:00
feat: Support Dynamic NFT (#1525)
Fix #1471 Clio's changes for supporting DNFT https://github.com/XRPLF/rippled/pull/5048/files
This commit is contained in:
@@ -421,3 +421,37 @@ TEST_F(BackendCassandraExecutionStrategyTest, StatsCallsCountersReport)
|
||||
EXPECT_CALL(*counters_, report());
|
||||
strat.stats();
|
||||
}
|
||||
|
||||
TEST_F(BackendCassandraExecutionStrategyTest, WriteEachAndCallSyncSucceeds)
|
||||
{
|
||||
auto strat = makeStrategy();
|
||||
auto const totalRequests = 1024u;
|
||||
auto const numStatements = 16u;
|
||||
auto callCount = std::atomic_uint{0u};
|
||||
|
||||
auto work = std::optional<boost::asio::io_context::work>{ctx_};
|
||||
auto thread = std::thread{[this]() { ctx_.run(); }};
|
||||
|
||||
EXPECT_CALL(handle_, asyncExecute(A<FakeStatement const&>(), A<std::function<void(FakeResultOrError)>&&>()))
|
||||
.Times(totalRequests * numStatements)
|
||||
.WillRepeatedly([this, &callCount](auto const&, auto&& cb) {
|
||||
// run on thread to emulate concurrency model of real asyncExecute
|
||||
boost::asio::post(ctx_, [&callCount, cb = std::forward<decltype(cb)>(cb)] {
|
||||
++callCount;
|
||||
cb({}); // pretend we got data
|
||||
});
|
||||
return FakeFutureWithCallback{};
|
||||
}); // numStatements per write call
|
||||
EXPECT_CALL(*counters_, registerWriteStarted()).Times(totalRequests * numStatements);
|
||||
EXPECT_CALL(*counters_, registerWriteFinished(testing::_)).Times(totalRequests * numStatements);
|
||||
|
||||
auto makeStatements = [] { return std::vector<FakeStatement>(16); };
|
||||
for (auto i = 0u; i < totalRequests; ++i)
|
||||
strat.writeEach(makeStatements());
|
||||
|
||||
strat.sync(); // make sure all above writes are finished
|
||||
EXPECT_EQ(callCount, totalRequests * numStatements); // all requests should finish
|
||||
|
||||
work.reset();
|
||||
thread.join();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user