mirror of
https://github.com/XRPLF/clio.git
synced 2025-12-06 17:27:58 +00:00
chore: Update boost usages to match 1.88 (#2355)
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "etl/impl/ForwardingSource.hpp"
|
||||
#include "rpc/Errors.hpp"
|
||||
#include "util/AsioContextTestFixture.hpp"
|
||||
#include "util/Spawn.hpp"
|
||||
#include "util/TestWsServer.hpp"
|
||||
|
||||
#include <boost/asio/spawn.hpp>
|
||||
@@ -78,7 +79,7 @@ protected:
|
||||
TEST_F(ForwardingSourceOperationsTests, XUserHeader)
|
||||
{
|
||||
std::string const xUserValue = "some_user";
|
||||
boost::asio::spawn(ctx_, [&](boost::asio::yield_context yield) {
|
||||
util::spawn(ctx_, [&](boost::asio::yield_context yield) {
|
||||
auto connection = serverConnection(yield);
|
||||
auto headers = connection.headers();
|
||||
ASSERT_FALSE(headers.empty());
|
||||
@@ -101,7 +102,7 @@ TEST_F(ForwardingSourceOperationsTests, XUserHeader)
|
||||
|
||||
TEST_F(ForwardingSourceOperationsTests, ReadFailed)
|
||||
{
|
||||
boost::asio::spawn(ctx_, [&](boost::asio::yield_context yield) {
|
||||
util::spawn(ctx_, [&](boost::asio::yield_context yield) {
|
||||
auto connection = serverConnection(yield);
|
||||
connection.close(yield);
|
||||
});
|
||||
@@ -116,7 +117,7 @@ TEST_F(ForwardingSourceOperationsTests, ReadFailed)
|
||||
TEST_F(ForwardingSourceOperationsTests, ReadTimeout)
|
||||
{
|
||||
TestWsConnectionPtr connection;
|
||||
boost::asio::spawn(ctx_, [&](boost::asio::yield_context yield) {
|
||||
util::spawn(ctx_, [&](boost::asio::yield_context yield) {
|
||||
connection = std::make_unique<TestWsConnection>(serverConnection(yield));
|
||||
});
|
||||
|
||||
@@ -129,7 +130,7 @@ TEST_F(ForwardingSourceOperationsTests, ReadTimeout)
|
||||
|
||||
TEST_F(ForwardingSourceOperationsTests, ParseFailed)
|
||||
{
|
||||
boost::asio::spawn(ctx_, [&](boost::asio::yield_context yield) {
|
||||
util::spawn(ctx_, [&](boost::asio::yield_context yield) {
|
||||
auto connection = serverConnection(yield);
|
||||
|
||||
auto receivedMessage = connection.receive(yield);
|
||||
@@ -151,7 +152,7 @@ TEST_F(ForwardingSourceOperationsTests, ParseFailed)
|
||||
|
||||
TEST_F(ForwardingSourceOperationsTests, GotNotAnObject)
|
||||
{
|
||||
boost::asio::spawn(ctx_, [&](boost::asio::yield_context yield) {
|
||||
util::spawn(ctx_, [&](boost::asio::yield_context yield) {
|
||||
auto connection = serverConnection(yield);
|
||||
|
||||
auto receivedMessage = connection.receive(yield);
|
||||
@@ -174,7 +175,7 @@ TEST_F(ForwardingSourceOperationsTests, GotNotAnObject)
|
||||
|
||||
TEST_F(ForwardingSourceOperationsTests, Success)
|
||||
{
|
||||
boost::asio::spawn(ctx_, [&](boost::asio::yield_context yield) {
|
||||
util::spawn(ctx_, [&](boost::asio::yield_context yield) {
|
||||
auto connection = serverConnection(yield);
|
||||
|
||||
auto receivedMessage = connection.receive(yield);
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include "etl/impl/SourceImpl.hpp"
|
||||
#include "rpc/Errors.hpp"
|
||||
#include "util/Spawn.hpp"
|
||||
|
||||
#include <boost/asio/io_context.hpp>
|
||||
#include <boost/asio/spawn.hpp>
|
||||
@@ -107,7 +108,7 @@ TEST_F(SourceImplTest, stop)
|
||||
{
|
||||
EXPECT_CALL(*subscriptionSourceMock_, stop);
|
||||
boost::asio::io_context ctx;
|
||||
boost::asio::spawn(ctx, [&](boost::asio::yield_context yield) { source_.stop(yield); });
|
||||
util::spawn(ctx, [&](boost::asio::yield_context yield) { source_.stop(yield); });
|
||||
ctx.run();
|
||||
}
|
||||
|
||||
@@ -192,7 +193,7 @@ TEST_F(SourceImplTest, forwardToRippled)
|
||||
.WillOnce(Return(request));
|
||||
|
||||
boost::asio::io_context ioContext;
|
||||
boost::asio::spawn(ioContext, [&](boost::asio::yield_context yield) {
|
||||
util::spawn(ioContext, [&](boost::asio::yield_context yield) {
|
||||
auto const response = source_.forwardToRippled(request, clientIp, xUserValue, yield);
|
||||
EXPECT_EQ(response, request);
|
||||
});
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "util/MockNetworkValidatedLedgers.hpp"
|
||||
#include "util/MockPrometheus.hpp"
|
||||
#include "util/MockSubscriptionManager.hpp"
|
||||
#include "util/Spawn.hpp"
|
||||
#include "util/TestWsServer.hpp"
|
||||
#include "util/prometheus/Gauge.hpp"
|
||||
|
||||
@@ -53,7 +54,7 @@ struct SubscriptionSourceConnectionTestsBase : SyncAsioContextTest {
|
||||
void
|
||||
stopSubscriptionSource()
|
||||
{
|
||||
boost::asio::spawn(ctx_, [this](auto&& yield) { subscriptionSource_.stop(yield); });
|
||||
util::spawn(ctx_, [this](auto&& yield) { subscriptionSource_.stop(yield); });
|
||||
}
|
||||
|
||||
[[maybe_unused]] TestWsConnection
|
||||
@@ -117,7 +118,7 @@ TEST_F(SubscriptionSourceConnectionTests, ConnectionFailed_Retry_ConnectionFaile
|
||||
|
||||
TEST_F(SubscriptionSourceConnectionTests, ReadError)
|
||||
{
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
util::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = serverConnection(yield);
|
||||
connection.close(yield);
|
||||
});
|
||||
@@ -129,7 +130,7 @@ TEST_F(SubscriptionSourceConnectionTests, ReadError)
|
||||
|
||||
TEST_F(SubscriptionSourceConnectionTests, ReadTimeout)
|
||||
{
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
util::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = serverConnection(yield);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds{10});
|
||||
});
|
||||
@@ -141,7 +142,7 @@ TEST_F(SubscriptionSourceConnectionTests, ReadTimeout)
|
||||
|
||||
TEST_F(SubscriptionSourceConnectionTests, ReadError_Reconnect)
|
||||
{
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
util::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
auto connection = serverConnection(yield);
|
||||
connection.close(yield);
|
||||
@@ -156,7 +157,7 @@ TEST_F(SubscriptionSourceConnectionTests, ReadError_Reconnect)
|
||||
TEST_F(SubscriptionSourceConnectionTests, IsConnected)
|
||||
{
|
||||
EXPECT_FALSE(subscriptionSource_.isConnected());
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
util::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = serverConnection(yield);
|
||||
connection.close(yield);
|
||||
});
|
||||
@@ -184,7 +185,7 @@ struct SubscriptionSourceReadTests : util::prometheus::WithPrometheus, Subscript
|
||||
|
||||
TEST_F(SubscriptionSourceReadTests, GotWrongMessage_Reconnect)
|
||||
{
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
util::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage("something", yield);
|
||||
// We have to schedule receiving to receive close frame and boost will handle it automatically
|
||||
connection.receive(yield);
|
||||
@@ -198,7 +199,7 @@ TEST_F(SubscriptionSourceReadTests, GotWrongMessage_Reconnect)
|
||||
|
||||
TEST_F(SubscriptionSourceReadTests, GotResult)
|
||||
{
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
util::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(R"JSON({"result":{})JSON", yield);
|
||||
connection.close(yield);
|
||||
});
|
||||
@@ -210,7 +211,7 @@ TEST_F(SubscriptionSourceReadTests, GotResult)
|
||||
|
||||
TEST_F(SubscriptionSourceReadTests, GotResultWithLedgerIndex)
|
||||
{
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
util::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(R"JSON({"result":{"ledger_index":123}})JSON", yield);
|
||||
connection.close(yield);
|
||||
});
|
||||
@@ -223,7 +224,7 @@ TEST_F(SubscriptionSourceReadTests, GotResultWithLedgerIndex)
|
||||
|
||||
TEST_F(SubscriptionSourceReadTests, GotResultWithLedgerIndexAsString_Reconnect)
|
||||
{
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
util::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(R"JSON({"result":{"ledger_index":"123"}})JSON", yield);
|
||||
// We have to schedule receiving to receive close frame and boost will handle it automatically
|
||||
connection.receive(yield);
|
||||
@@ -237,7 +238,7 @@ TEST_F(SubscriptionSourceReadTests, GotResultWithLedgerIndexAsString_Reconnect)
|
||||
|
||||
TEST_F(SubscriptionSourceReadTests, GotResultWithValidatedLedgersAsNumber_Reconnect)
|
||||
{
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
util::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(R"JSON({"result":{"validated_ledgers":123}})JSON", yield);
|
||||
// We have to schedule receiving to receive close frame and boost will handle it automatically
|
||||
connection.receive(yield);
|
||||
@@ -261,7 +262,7 @@ TEST_F(SubscriptionSourceReadTests, GotResultWithValidatedLedgers)
|
||||
EXPECT_FALSE(subscriptionSource_.hasLedger(789));
|
||||
EXPECT_FALSE(subscriptionSource_.hasLedger(790));
|
||||
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
util::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(R"JSON({"result":{"validated_ledgers":"123-456,789,32"}})JSON", yield);
|
||||
connection.close(yield);
|
||||
});
|
||||
@@ -285,7 +286,7 @@ TEST_F(SubscriptionSourceReadTests, GotResultWithValidatedLedgers)
|
||||
|
||||
TEST_F(SubscriptionSourceReadTests, GotResultWithValidatedLedgersWrongValue_Reconnect)
|
||||
{
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
util::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(R"JSON({"result":{"validated_ledgers":"123-456-789,32"}})JSON", yield);
|
||||
// We have to schedule receiving to receive close frame and boost will handle it automatically
|
||||
connection.receive(yield);
|
||||
@@ -305,7 +306,7 @@ TEST_F(SubscriptionSourceReadTests, GotResultWithLedgerIndexAndValidatedLedgers)
|
||||
EXPECT_FALSE(subscriptionSource_.hasLedger(3));
|
||||
EXPECT_FALSE(subscriptionSource_.hasLedger(4));
|
||||
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
util::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection =
|
||||
connectAndSendMessage(R"JSON({"result":{"ledger_index":123,"validated_ledgers":"1-3"}})JSON", yield);
|
||||
connection.close(yield);
|
||||
@@ -326,7 +327,7 @@ TEST_F(SubscriptionSourceReadTests, GotResultWithLedgerIndexAndValidatedLedgers)
|
||||
|
||||
TEST_F(SubscriptionSourceReadTests, GotLedgerClosed)
|
||||
{
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
util::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(R"JSON({"type":"ledgerClosed"})JSON", yield);
|
||||
connection.close(yield);
|
||||
});
|
||||
@@ -340,7 +341,7 @@ TEST_F(SubscriptionSourceReadTests, GotLedgerClosedForwardingIsSet)
|
||||
{
|
||||
subscriptionSource_.setForwarding(true);
|
||||
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
util::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(R"JSON({"type": "ledgerClosed"})JSON", yield);
|
||||
connection.close(yield);
|
||||
});
|
||||
@@ -356,7 +357,7 @@ TEST_F(SubscriptionSourceReadTests, GotLedgerClosedForwardingIsSet)
|
||||
|
||||
TEST_F(SubscriptionSourceReadTests, GotLedgerClosedWithLedgerIndex)
|
||||
{
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
util::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(R"JSON({"type": "ledgerClosed","ledger_index": 123})JSON", yield);
|
||||
connection.close(yield);
|
||||
});
|
||||
@@ -369,7 +370,7 @@ TEST_F(SubscriptionSourceReadTests, GotLedgerClosedWithLedgerIndex)
|
||||
|
||||
TEST_F(SubscriptionSourceReadTests, GotLedgerClosedWithLedgerIndexAsString_Reconnect)
|
||||
{
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
util::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(R"JSON({"type":"ledgerClosed","ledger_index":"123"}})JSON", yield);
|
||||
// We have to schedule receiving to receive close frame and boost will handle it automatically
|
||||
connection.receive(yield);
|
||||
@@ -383,7 +384,7 @@ TEST_F(SubscriptionSourceReadTests, GotLedgerClosedWithLedgerIndexAsString_Recon
|
||||
|
||||
TEST_F(SubscriptionSourceReadTests, GorLedgerClosedWithValidatedLedgersAsNumber_Reconnect)
|
||||
{
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
util::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(R"JSON({"type":"ledgerClosed","validated_ledgers":123})JSON", yield);
|
||||
// We have to schedule receiving to receive close frame and boost will handle it automatically
|
||||
connection.receive(yield);
|
||||
@@ -402,7 +403,7 @@ TEST_F(SubscriptionSourceReadTests, GotLedgerClosedWithValidatedLedgers)
|
||||
EXPECT_FALSE(subscriptionSource_.hasLedger(2));
|
||||
EXPECT_FALSE(subscriptionSource_.hasLedger(3));
|
||||
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
util::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(R"JSON({"type":"ledgerClosed","validated_ledgers":"1-2"})JSON", yield);
|
||||
connection.close(yield);
|
||||
});
|
||||
@@ -425,7 +426,7 @@ TEST_F(SubscriptionSourceReadTests, GotLedgerClosedWithLedgerIndexAndValidatedLe
|
||||
EXPECT_FALSE(subscriptionSource_.hasLedger(2));
|
||||
EXPECT_FALSE(subscriptionSource_.hasLedger(3));
|
||||
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
util::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(
|
||||
R"JSON({"type":"ledgerClosed","ledger_index":123,"validated_ledgers":"1-2"})JSON", yield
|
||||
);
|
||||
@@ -446,7 +447,7 @@ TEST_F(SubscriptionSourceReadTests, GotLedgerClosedWithLedgerIndexAndValidatedLe
|
||||
|
||||
TEST_F(SubscriptionSourceReadTests, GotTransactionIsForwardingFalse)
|
||||
{
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
util::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(R"JSON({"transaction":"some_transaction_data"})JSON", yield);
|
||||
connection.close(yield);
|
||||
});
|
||||
@@ -461,7 +462,7 @@ TEST_F(SubscriptionSourceReadTests, GotTransactionIsForwardingTrue)
|
||||
subscriptionSource_.setForwarding(true);
|
||||
boost::json::object const message = {{"transaction", "some_transaction_data"}};
|
||||
|
||||
boost::asio::spawn(ctx_, [&message, this](boost::asio::yield_context yield) {
|
||||
util::spawn(ctx_, [&message, this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(boost::json::serialize(message), yield);
|
||||
connection.close(yield);
|
||||
});
|
||||
@@ -477,7 +478,7 @@ TEST_F(SubscriptionSourceReadTests, GotTransactionWithMetaIsForwardingFalse)
|
||||
subscriptionSource_.setForwarding(true);
|
||||
boost::json::object const message = {{"transaction", "some_transaction_data"}, {"meta", "some_meta_data"}};
|
||||
|
||||
boost::asio::spawn(ctx_, [&message, this](boost::asio::yield_context yield) {
|
||||
util::spawn(ctx_, [&message, this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(boost::json::serialize(message), yield);
|
||||
connection.close(yield);
|
||||
});
|
||||
@@ -490,7 +491,7 @@ TEST_F(SubscriptionSourceReadTests, GotTransactionWithMetaIsForwardingFalse)
|
||||
|
||||
TEST_F(SubscriptionSourceReadTests, GotValidationReceivedIsForwardingFalse)
|
||||
{
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
util::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(R"JSON({"type":"validationReceived"})JSON", yield);
|
||||
connection.close(yield);
|
||||
});
|
||||
@@ -505,7 +506,7 @@ TEST_F(SubscriptionSourceReadTests, GotValidationReceivedIsForwardingTrue)
|
||||
subscriptionSource_.setForwarding(true);
|
||||
boost::json::object const message = {{"type", "validationReceived"}};
|
||||
|
||||
boost::asio::spawn(ctx_, [&message, this](boost::asio::yield_context yield) {
|
||||
util::spawn(ctx_, [&message, this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(boost::json::serialize(message), yield);
|
||||
connection.close(yield);
|
||||
});
|
||||
@@ -518,7 +519,7 @@ TEST_F(SubscriptionSourceReadTests, GotValidationReceivedIsForwardingTrue)
|
||||
|
||||
TEST_F(SubscriptionSourceReadTests, GotManiefstReceivedIsForwardingFalse)
|
||||
{
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
util::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(R"JSON({"type":"manifestReceived"})JSON", yield);
|
||||
connection.close(yield);
|
||||
});
|
||||
@@ -533,7 +534,7 @@ TEST_F(SubscriptionSourceReadTests, GotManifestReceivedIsForwardingTrue)
|
||||
subscriptionSource_.setForwarding(true);
|
||||
boost::json::object const message = {{"type", "manifestReceived"}};
|
||||
|
||||
boost::asio::spawn(ctx_, [&message, this](boost::asio::yield_context yield) {
|
||||
util::spawn(ctx_, [&message, this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(boost::json::serialize(message), yield);
|
||||
connection.close(yield);
|
||||
});
|
||||
@@ -546,7 +547,7 @@ TEST_F(SubscriptionSourceReadTests, GotManifestReceivedIsForwardingTrue)
|
||||
|
||||
TEST_F(SubscriptionSourceReadTests, LastMessageTime)
|
||||
{
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
util::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage("some_message", yield);
|
||||
connection.close(yield);
|
||||
});
|
||||
@@ -569,7 +570,7 @@ TEST_F(SubscriptionSourcePrometheusCounterTests, LastMessageTime)
|
||||
auto& lastMessageTimeMock = makeMock<util::prometheus::GaugeInt>(
|
||||
"subscription_source_last_message_time", fmt::format("{{source=\"127.0.0.1:{}\"}}", wsServer_.port())
|
||||
);
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
util::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage("some_message", yield);
|
||||
connection.close(yield);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user