mirror of
https://github.com/XRPLF/clio.git
synced 2025-12-06 17:27:58 +00:00
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <util/Assert.h>
|
||||
#include "util/Assert.h"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <util/Atomic.h>
|
||||
#include "util/Atomic.h"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
|
||||
@@ -19,17 +19,16 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "MockBackend.h"
|
||||
#include "MockCounters.h"
|
||||
#include "MockETLService.h"
|
||||
#include "MockLoadBalancer.h"
|
||||
#include "MockSubscriptionManager.h"
|
||||
#include <util/log/Logger.h>
|
||||
#include "util/MockBackend.h"
|
||||
#include "util/MockCounters.h"
|
||||
#include "util/MockETLService.h"
|
||||
#include "util/MockLoadBalancer.h"
|
||||
#include "util/MockSubscriptionManager.h"
|
||||
#include "util/log/Logger.h"
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <ios>
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <data/BackendInterface.h>
|
||||
#include "data/BackendInterface.h"
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
|
||||
using namespace data;
|
||||
@@ -160,11 +161,11 @@ struct MockBackend : public BackendInterface {
|
||||
(override)
|
||||
);
|
||||
|
||||
MOCK_METHOD(void, writeNFTs, (std::vector<NFTsData>&&), (override));
|
||||
MOCK_METHOD(void, writeNFTs, (std::vector<NFTsData> const&), (override));
|
||||
|
||||
MOCK_METHOD(void, writeAccountTransactions, (std::vector<AccountTransactionsData>&&), (override));
|
||||
MOCK_METHOD(void, writeAccountTransactions, (std::vector<AccountTransactionsData>), (override));
|
||||
|
||||
MOCK_METHOD(void, writeNFTTransactions, (std::vector<NFTTransactionsData>&&), (override));
|
||||
MOCK_METHOD(void, writeNFTTransactions, (std::vector<NFTTransactionsData> const&), (override));
|
||||
|
||||
MOCK_METHOD(void, writeSuccessor, (std::string && key, std::uint32_t const, std::string&&), (override));
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <data/Types.h>
|
||||
#include "data/Types.h"
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <etl/ETLState.h>
|
||||
#include "etl/ETLState.h"
|
||||
|
||||
#include <boost/json.hpp>
|
||||
#include <gmock/gmock.h>
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <rpc/common/AnyHandler.h>
|
||||
#include <rpc/common/Types.h>
|
||||
#include "rpc/common/AnyHandler.h"
|
||||
#include "rpc/common/Types.h"
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <util/FakeFetchResponse.h>
|
||||
#include "util/FakeFetchResponse.h"
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <etl/impl/LedgerLoader.h>
|
||||
#include "etl/impl/LedgerLoader.h"
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <etl/Source.h>
|
||||
#include <util/FakeFetchResponse.h>
|
||||
#include "etl/Source.h"
|
||||
#include "util/FakeFetchResponse.h"
|
||||
|
||||
#include <boost/asio/spawn.hpp>
|
||||
#include <boost/json.hpp>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <util/prometheus/Prometheus.h>
|
||||
#include "util/prometheus/Prometheus.h"
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
//==============================================================================
|
||||
|
||||
#pragma once
|
||||
#include <rpc/common/Types.h>
|
||||
#include <web/Context.h>
|
||||
#include "rpc/common/Types.h"
|
||||
#include "web/Context.h"
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
@@ -18,14 +18,14 @@
|
||||
//==============================================================================
|
||||
#pragma once
|
||||
|
||||
#include <etl/Source.h>
|
||||
#include "etl/Source.h"
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
|
||||
class MockSource : public etl::Source {
|
||||
public:
|
||||
MOCK_METHOD(bool, isConnected, (), (const, override));
|
||||
MOCK_METHOD(boost::json::object, toJson, (), (const override));
|
||||
MOCK_METHOD(boost::json::object, toJson, (), (const, override));
|
||||
MOCK_METHOD(void, run, (), (override));
|
||||
MOCK_METHOD(void, pause, (), (override));
|
||||
MOCK_METHOD(void, resume, (), (override));
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <web/interface/ConnectionBase.h>
|
||||
#include "web/interface/ConnectionBase.h"
|
||||
|
||||
#include <boost/asio/spawn.hpp>
|
||||
#include <boost/json.hpp>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <web/interface/ConnectionBase.h>
|
||||
#include "web/interface/ConnectionBase.h"
|
||||
|
||||
struct MockSession : public web::ConnectionBase {
|
||||
std::string message;
|
||||
|
||||
@@ -17,9 +17,15 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <util/StringUtils.h>
|
||||
#include "util/StringUtils.h"
|
||||
|
||||
#include <rpc/RPCHelpers.h>
|
||||
#include "rpc/RPCHelpers.h"
|
||||
|
||||
#include <ripple/basics/StringUtilities.h>
|
||||
#include <ripple/basics/base_uint.h>
|
||||
#include <ripple/protocol/LedgerHeader.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
std::string
|
||||
hexStringToBinaryString(std::string const& hex)
|
||||
|
||||
@@ -17,14 +17,39 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include "TestObject.h"
|
||||
#include <data/DBHelpers.h>
|
||||
#include <rpc/RPCHelpers.h>
|
||||
#include "util/TestObject.h"
|
||||
|
||||
#include "data/DBHelpers.h"
|
||||
#include "data/Types.h"
|
||||
|
||||
#include <ripple/basics/Blob.h>
|
||||
#include <ripple/basics/Slice.h>
|
||||
#include <ripple/basics/base_uint.h>
|
||||
#include <ripple/basics/chrono.h>
|
||||
#include <ripple/protocol/AccountID.h>
|
||||
#include <ripple/protocol/Issue.h>
|
||||
#include <ripple/protocol/LedgerFormats.h>
|
||||
#include <ripple/protocol/LedgerHeader.h>
|
||||
#include <ripple/protocol/Protocol.h>
|
||||
#include <ripple/protocol/SField.h>
|
||||
#include <ripple/protocol/STAmount.h>
|
||||
#include <ripple/protocol/STArray.h>
|
||||
#include <ripple/protocol/STIssue.h>
|
||||
#include <ripple/protocol/STObject.h>
|
||||
#include <ripple/protocol/STVector256.h>
|
||||
#include <ripple/protocol/TER.h>
|
||||
#include <ripple/protocol/TxFormats.h>
|
||||
#include <ripple/protocol/UintTypes.h>
|
||||
#include <ripple/protocol/tokens.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
constexpr static auto INDEX1 = "1B8590C01B0006EDFA9ED60296DD052DC5E90F99659B25014D08E1BC983515BC";
|
||||
constexpr static auto CURRENCY = "03930D02208264E2E40EC1B0C09E4DB96EE197B1";
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <data/Types.h>
|
||||
#include "data/Types.h"
|
||||
|
||||
#include <ripple/protocol/LedgerHeader.h>
|
||||
#include <ripple/protocol/Protocol.h>
|
||||
|
||||
@@ -17,13 +17,16 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <util/prometheus/Counter.h>
|
||||
#include "util/prometheus/Counter.h"
|
||||
#include "util/prometheus/OStream.h"
|
||||
|
||||
#include <boost/iostreams/device/back_inserter.hpp>
|
||||
#include <gmock/gmock.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <utility>
|
||||
|
||||
using namespace util::prometheus;
|
||||
|
||||
|
||||
@@ -17,11 +17,12 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <util/prometheus/Gauge.h>
|
||||
#include "util/prometheus/Gauge.h"
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <thread>
|
||||
|
||||
using namespace util::prometheus;
|
||||
|
||||
@@ -17,11 +17,17 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <util/prometheus/Histogram.h>
|
||||
#include "util/prometheus/Histogram.h"
|
||||
#include "util/prometheus/OStream.h"
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
using namespace util::prometheus;
|
||||
|
||||
struct AnyHistogramTests : ::testing::Test {
|
||||
|
||||
@@ -16,13 +16,24 @@
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
#include <util/prometheus/Http.h>
|
||||
#include "util/MockPrometheus.h"
|
||||
#include "util/config/Config.h"
|
||||
#include "util/prometheus/Http.h"
|
||||
#include "util/prometheus/Label.h"
|
||||
#include "util/prometheus/Prometheus.h"
|
||||
|
||||
#include <util/MockPrometheus.h>
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <boost/beast/http/field.hpp>
|
||||
#include <boost/beast/http/message.hpp>
|
||||
#include <boost/beast/http/status.hpp>
|
||||
#include <boost/beast/http/string_body.hpp>
|
||||
#include <boost/beast/http/verb.hpp>
|
||||
#include <boost/json/object.hpp>
|
||||
#include <boost/json/value.hpp>
|
||||
#include <fmt/core.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
using namespace util::prometheus;
|
||||
namespace http = boost::beast::http;
|
||||
|
||||
@@ -67,35 +78,40 @@ INSTANTIATE_TEST_CASE_P(
|
||||
.target = "/metrics",
|
||||
.isAdmin = true,
|
||||
.prometheusEnabled = true,
|
||||
.expected = true},
|
||||
.expected = true
|
||||
},
|
||||
PrometheusCheckRequestTestsParams{
|
||||
.testName = "validRequestPrometheusDisabled",
|
||||
.method = http::verb::get,
|
||||
.target = "/metrics",
|
||||
.isAdmin = true,
|
||||
.prometheusEnabled = false,
|
||||
.expected = true},
|
||||
.expected = true
|
||||
},
|
||||
PrometheusCheckRequestTestsParams{
|
||||
.testName = "notAdmin",
|
||||
.method = http::verb::get,
|
||||
.target = "/metrics",
|
||||
.isAdmin = false,
|
||||
.prometheusEnabled = true,
|
||||
.expected = true},
|
||||
.expected = true
|
||||
},
|
||||
PrometheusCheckRequestTestsParams{
|
||||
.testName = "wrongMethod",
|
||||
.method = http::verb::post,
|
||||
.target = "/metrics",
|
||||
.isAdmin = true,
|
||||
.prometheusEnabled = true,
|
||||
.expected = false},
|
||||
.expected = false
|
||||
},
|
||||
PrometheusCheckRequestTestsParams{
|
||||
.testName = "wrongTarget",
|
||||
.method = http::verb::get,
|
||||
.target = "/",
|
||||
.isAdmin = true,
|
||||
.prometheusEnabled = true,
|
||||
.expected = false},
|
||||
.expected = false
|
||||
},
|
||||
}),
|
||||
PrometheusCheckRequestTests::NameGenerator()
|
||||
);
|
||||
@@ -132,7 +148,7 @@ TEST_F(PrometheusHandleRequestTests, notAdmin)
|
||||
TEST_F(PrometheusHandleRequestTests, responseWithCounter)
|
||||
{
|
||||
auto const counterName = "test_counter";
|
||||
const Labels labels{{{"label1", "value1"}, Label{"label2", "value2"}}};
|
||||
Labels const labels{{{"label1", "value1"}, Label{"label2", "value2"}}};
|
||||
auto const description = "test_description";
|
||||
|
||||
auto& counter = PrometheusService::counterInt(counterName, labels, description);
|
||||
@@ -151,7 +167,7 @@ TEST_F(PrometheusHandleRequestTests, responseWithCounter)
|
||||
TEST_F(PrometheusHandleRequestTests, responseWithGauge)
|
||||
{
|
||||
auto const gaugeName = "test_gauge";
|
||||
const Labels labels{{{"label2", "value2"}, {"label3", "value3"}}};
|
||||
Labels const labels{{{"label2", "value2"}, {"label3", "value3"}}};
|
||||
auto const description = "test_description_gauge";
|
||||
|
||||
auto& gauge = PrometheusService::gaugeInt(gaugeName, labels, description);
|
||||
@@ -170,7 +186,7 @@ TEST_F(PrometheusHandleRequestTests, responseWithGauge)
|
||||
TEST_F(PrometheusHandleRequestTests, responseWithCounterAndGauge)
|
||||
{
|
||||
auto const counterName = "test_counter";
|
||||
const Labels counterLabels{{{"label1", "value1"}, {"label2", "value2"}}};
|
||||
Labels const counterLabels{{{"label1", "value1"}, {"label2", "value2"}}};
|
||||
auto const counterDescription = "test_description";
|
||||
|
||||
auto& counter = PrometheusService::counterInt(counterName, counterLabels, counterDescription);
|
||||
@@ -178,7 +194,7 @@ TEST_F(PrometheusHandleRequestTests, responseWithCounterAndGauge)
|
||||
counter += 3;
|
||||
|
||||
auto const gaugeName = "test_gauge";
|
||||
const Labels gaugeLabels{{{"label2", "value2"}, {"label3", "value3"}}};
|
||||
Labels const gaugeLabels{{{"label2", "value2"}, {"label3", "value3"}}};
|
||||
auto const gaugeDescription = "test_description_gauge";
|
||||
|
||||
auto& gauge = PrometheusService::gaugeInt(gaugeName, gaugeLabels, gaugeDescription);
|
||||
@@ -214,8 +230,9 @@ TEST_F(PrometheusHandleRequestTests, responseWithCounterAndGauge)
|
||||
|
||||
TEST_F(PrometheusHandleRequestTests, compressReply)
|
||||
{
|
||||
PrometheusService::init(util::Config(boost::json::value{
|
||||
{"prometheus", boost::json::object{{"compress_reply", true}}}}));
|
||||
PrometheusService::init(
|
||||
util::Config(boost::json::value{{"prometheus", boost::json::object{{"compress_reply", true}}}})
|
||||
);
|
||||
|
||||
auto& gauge = PrometheusService::gaugeInt("test_gauge", Labels{});
|
||||
++gauge;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <util/prometheus/Label.h>
|
||||
#include "util/prometheus/Label.h"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
|
||||
@@ -17,13 +17,19 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <util/prometheus/Counter.h>
|
||||
#include <util/prometheus/Gauge.h>
|
||||
#include <util/prometheus/Histogram.h>
|
||||
#include <util/prometheus/MetricBuilder.h>
|
||||
#include "util/prometheus/Counter.h"
|
||||
#include "util/prometheus/Gauge.h"
|
||||
#include "util/prometheus/Histogram.h"
|
||||
#include "util/prometheus/MetricBase.h"
|
||||
#include "util/prometheus/MetricBuilder.h"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
using namespace util::prometheus;
|
||||
|
||||
TEST(MetricBuilderTest, build)
|
||||
|
||||
@@ -17,12 +17,22 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <util/prometheus/MetricsFamily.h>
|
||||
#include "util/prometheus/Label.h"
|
||||
#include "util/prometheus/MetricBase.h"
|
||||
#include "util/prometheus/MetricBuilder.h"
|
||||
#include "util/prometheus/MetricsFamily.h"
|
||||
#include "util/prometheus/OStream.h"
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/core.h>
|
||||
#include <gmock/gmock.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
using namespace util::prometheus;
|
||||
|
||||
struct MetricsFamilyTest : ::testing::Test {
|
||||
|
||||
@@ -17,11 +17,16 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <util/prometheus/OStream.h>
|
||||
#include "util/prometheus/OStream.h"
|
||||
|
||||
#include <boost/iostreams/device/array.hpp>
|
||||
#include <boost/iostreams/filter/gzip.hpp>
|
||||
#include <boost/iostreams/filtering_stream.hpp>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
using namespace util::prometheus;
|
||||
|
||||
TEST(OStreamTests, empty)
|
||||
|
||||
Reference in New Issue
Block a user