mirror of
https://github.com/XRPLF/clio.git
synced 2025-11-05 04:15:51 +00:00
test: Remove SetUp and TearDown methods in tests (#2086)
Fix: https://github.com/XRPLF/clio/issues/910
This commit is contained in:
@@ -85,8 +85,7 @@ protected:
|
||||
|
||||
class BackendCassandraFactoryTestWithDB : public BackendCassandraFactoryTest {
|
||||
protected:
|
||||
void
|
||||
TearDown() override
|
||||
~BackendCassandraFactoryTestWithDB()
|
||||
{
|
||||
// drop the keyspace for next test
|
||||
data::cassandra::Handle const handle{TestGlobals::instance().backendHost};
|
||||
|
||||
@@ -111,26 +111,17 @@ protected:
|
||||
|
||||
// recreated for each test
|
||||
data::LedgerCache cache_;
|
||||
std::unique_ptr<BackendInterface> backend_;
|
||||
std::unique_ptr<BackendInterface> backend_{std::make_unique<CassandraBackend>(settingsProvider_, cache_, false)};
|
||||
|
||||
void
|
||||
SetUp() override
|
||||
{
|
||||
SyncAsioContextTest::SetUp();
|
||||
backend_ = std::make_unique<CassandraBackend>(settingsProvider_, cache_, false);
|
||||
}
|
||||
void
|
||||
TearDown() override
|
||||
{
|
||||
backend_.reset();
|
||||
std::default_random_engine randomEngine_{0};
|
||||
|
||||
~BackendCassandraTest()
|
||||
{
|
||||
// drop the keyspace for next test
|
||||
Handle const handle{TestGlobals::instance().backendHost};
|
||||
EXPECT_TRUE(handle.connect());
|
||||
handle.execute("DROP KEYSPACE " + TestGlobals::instance().backendKeyspace);
|
||||
}
|
||||
|
||||
std::default_random_engine randomEngine_{0};
|
||||
};
|
||||
|
||||
TEST_F(BackendCassandraTest, Basic)
|
||||
|
||||
@@ -155,8 +155,7 @@ protected:
|
||||
setupDatabase();
|
||||
}
|
||||
|
||||
void
|
||||
TearDown() override
|
||||
~MigrationCassandraSimpleTest()
|
||||
{
|
||||
// drop the keyspace
|
||||
Handle const handle{TestGlobals::instance().backendHost};
|
||||
|
||||
@@ -55,17 +55,6 @@ constexpr auto kAGE = 800;
|
||||
} // namespace
|
||||
|
||||
struct ETLLedgerPublisherTest : util::prometheus::WithPrometheus, MockBackendTestStrict, SyncAsioContextTest {
|
||||
void
|
||||
SetUp() override
|
||||
{
|
||||
SyncAsioContextTest::SetUp();
|
||||
}
|
||||
|
||||
void
|
||||
TearDown() override
|
||||
{
|
||||
SyncAsioContextTest::TearDown();
|
||||
}
|
||||
util::config::ClioConfigDefinition cfg{{}};
|
||||
MockLedgerCache mockCache;
|
||||
StrictMockSubscriptionManagerSharedPtr mockSubscriptionManagerPtr;
|
||||
|
||||
@@ -60,8 +60,7 @@ struct ETLTransformerTest : util::prometheus::WithPrometheus, MockBackendTest {
|
||||
using TransformerType = etl::impl::
|
||||
Transformer<ExtractionDataPipeType, LedgerLoaderType, LedgerPublisherType, AmendmentBlockHandlerType>;
|
||||
|
||||
void
|
||||
SetUp() override
|
||||
ETLTransformerTest()
|
||||
{
|
||||
state_.isStopping = false;
|
||||
state_.writeConflict = false;
|
||||
@@ -69,12 +68,6 @@ struct ETLTransformerTest : util::prometheus::WithPrometheus, MockBackendTest {
|
||||
state_.isWriting = false;
|
||||
}
|
||||
|
||||
void
|
||||
TearDown() override
|
||||
{
|
||||
transformer_.reset();
|
||||
}
|
||||
|
||||
protected:
|
||||
ExtractionDataPipeType dataPipe_;
|
||||
LedgerLoaderType ledgerLoader_;
|
||||
|
||||
@@ -86,16 +86,10 @@ constexpr auto kAMM_ID = 54321;
|
||||
} // namespace
|
||||
|
||||
class RPCHelpersTest : public util::prometheus::WithPrometheus, public MockBackendTest, public SyncAsioContextTest {
|
||||
void
|
||||
SetUp() override
|
||||
public:
|
||||
RPCHelpersTest()
|
||||
{
|
||||
backend_->setRange(10, 300);
|
||||
SyncAsioContextTest::SetUp();
|
||||
}
|
||||
void
|
||||
TearDown() override
|
||||
{
|
||||
SyncAsioContextTest::TearDown();
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
@@ -89,10 +89,8 @@ mockLedgerObject(
|
||||
|
||||
class RPCGetAggregatePriceHandlerTest : public HandlerBaseTest {
|
||||
protected:
|
||||
void
|
||||
SetUp() override
|
||||
RPCGetAggregatePriceHandlerTest()
|
||||
{
|
||||
HandlerBaseTest::SetUp();
|
||||
backend_->setRange(kRANGE_MIN, kRANGE_MAX);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -56,24 +56,11 @@ constexpr auto kCLIENT_IP = "1.1.1.1";
|
||||
} // namespace
|
||||
|
||||
struct RPCServerInfoHandlerTest : HandlerBaseTest, MockLoadBalancerTest, MockCountersTest {
|
||||
void
|
||||
SetUp() override
|
||||
RPCServerInfoHandlerTest()
|
||||
{
|
||||
HandlerBaseTest::SetUp();
|
||||
MockLoadBalancerTest::SetUp();
|
||||
MockCountersTest::SetUp();
|
||||
|
||||
backend_->setRange(10, 30);
|
||||
}
|
||||
|
||||
void
|
||||
TearDown() override
|
||||
{
|
||||
MockCountersTest::TearDown();
|
||||
MockLoadBalancerTest::TearDown();
|
||||
HandlerBaseTest::TearDown();
|
||||
}
|
||||
|
||||
static void
|
||||
validateNormalOutput(rpc::ReturnType const& output)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user