mirror of
https://github.com/XRPLF/clio.git
synced 2025-12-06 17:27:58 +00:00
Create generate free port class to avoid conflicting ports (#1439)
Fixes #1317
This commit is contained in:
@@ -37,8 +37,13 @@
|
||||
using namespace etl::impl;
|
||||
|
||||
struct ForwardingSourceTests : SyncAsioContextTest {
|
||||
TestWsServer server_{ctx, "0.0.0.0", 11114};
|
||||
ForwardingSource forwardingSource{"127.0.0.1", "11114", std::chrono::milliseconds{1}, std::chrono::milliseconds{1}};
|
||||
TestWsServer server_{ctx, "0.0.0.0"};
|
||||
ForwardingSource forwardingSource{
|
||||
"127.0.0.1",
|
||||
server_.port(),
|
||||
std::chrono::milliseconds{1},
|
||||
std::chrono::milliseconds{1}
|
||||
};
|
||||
};
|
||||
|
||||
TEST_F(ForwardingSourceTests, ConnectionFailed)
|
||||
|
||||
@@ -42,9 +42,9 @@ using namespace etl::impl;
|
||||
|
||||
struct GrpcSourceTests : NoLoggerFixture, util::prometheus::WithPrometheus, tests::util::WithMockXrpLedgerAPIService {
|
||||
GrpcSourceTests()
|
||||
: WithMockXrpLedgerAPIService("localhost:55051")
|
||||
: WithMockXrpLedgerAPIService("localhost:0")
|
||||
, mockBackend_(std::make_shared<testing::StrictMock<MockBackend>>(util::Config{}))
|
||||
, grpcSource_("127.0.0.1", "55051", mockBackend_)
|
||||
, grpcSource_("127.0.0.1", std::to_string(getXRPLMockPort()), mockBackend_)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
//==============================================================================
|
||||
|
||||
#include "etl/impl/SubscriptionSource.hpp"
|
||||
#include "util/AssignRandomPort.hpp"
|
||||
#include "util/Fixtures.hpp"
|
||||
#include "util/MockNetworkValidatedLedgers.hpp"
|
||||
#include "util/MockSubscriptionManager.hpp"
|
||||
@@ -31,6 +32,7 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
@@ -46,8 +48,7 @@ struct SubscriptionSourceConnectionTests : public NoLoggerFixture {
|
||||
}
|
||||
|
||||
boost::asio::io_context ioContext_;
|
||||
|
||||
TestWsServer wsServer_{ioContext_, "0.0.0.0", 11113};
|
||||
TestWsServer wsServer_{ioContext_, "0.0.0.0"};
|
||||
|
||||
StrictMockNetworkValidatedLedgersPtr networkValidatedLedgers_;
|
||||
StrictMockSubscriptionManagerSharedPtr subscriptionManager_;
|
||||
@@ -59,7 +60,7 @@ struct SubscriptionSourceConnectionTests : public NoLoggerFixture {
|
||||
SubscriptionSource subscriptionSource_{
|
||||
ioContext_,
|
||||
"127.0.0.1",
|
||||
"11113",
|
||||
wsServer_.port(),
|
||||
networkValidatedLedgers_,
|
||||
subscriptionManager_,
|
||||
onConnectHook_.AsStdFunction(),
|
||||
|
||||
Reference in New Issue
Block a user