Skip to content

Commit

Permalink
FIX TESTS WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev committed Jan 14, 2024
1 parent 79f4bfc commit a5fb250
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 86 deletions.
96 changes: 48 additions & 48 deletions nano/core_test/block_store.cpp

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions nano/core_test/bootstrap_ascending.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ nano::block_hash random_hash ()
TEST (account_sets, construction)
{
nano::stats stats;
nano::nlogger logger;
nano::nlogger & logger = nano::default_logger ();
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_FALSE (store->init_error ());
nano::bootstrap_ascending::account_sets sets{ stats };
Expand All @@ -35,7 +35,7 @@ TEST (account_sets, empty_blocked)
{
nano::account account{ 1 };
nano::stats stats;
nano::nlogger logger;
nano::nlogger & logger = nano::default_logger ();
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_FALSE (store->init_error ());
nano::bootstrap_ascending::account_sets sets{ stats };
Expand All @@ -46,7 +46,7 @@ TEST (account_sets, block)
{
nano::account account{ 1 };
nano::stats stats;
nano::nlogger logger;
nano::nlogger & logger = nano::default_logger ();
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_FALSE (store->init_error ());
nano::bootstrap_ascending::account_sets sets{ stats };
Expand All @@ -58,7 +58,7 @@ TEST (account_sets, unblock)
{
nano::account account{ 1 };
nano::stats stats;
nano::nlogger logger;
nano::nlogger & logger = nano::default_logger ();
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_FALSE (store->init_error ());
nano::bootstrap_ascending::account_sets sets{ stats };
Expand All @@ -72,7 +72,7 @@ TEST (account_sets, priority_base)
{
nano::account account{ 1 };
nano::stats stats;
nano::nlogger logger;
nano::nlogger & logger = nano::default_logger ();
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_FALSE (store->init_error ());
nano::bootstrap_ascending::account_sets sets{ stats };
Expand All @@ -83,7 +83,7 @@ TEST (account_sets, priority_blocked)
{
nano::account account{ 1 };
nano::stats stats;
nano::nlogger logger;
nano::nlogger & logger = nano::default_logger ();
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_FALSE (store->init_error ());
nano::bootstrap_ascending::account_sets sets{ stats };
Expand All @@ -96,7 +96,7 @@ TEST (account_sets, priority_unblock_keep)
{
nano::account account{ 1 };
nano::stats stats;
nano::nlogger logger;
nano::nlogger & logger = nano::default_logger ();
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_FALSE (store->init_error ());
nano::bootstrap_ascending::account_sets sets{ stats };
Expand All @@ -114,7 +114,7 @@ TEST (account_sets, priority_up_down)
{
nano::account account{ 1 };
nano::stats stats;
nano::nlogger logger;
nano::nlogger & logger = nano::default_logger ();
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_FALSE (store->init_error ());
nano::bootstrap_ascending::account_sets sets{ stats };
Expand All @@ -129,7 +129,7 @@ TEST (account_sets, priority_down_sat)
{
nano::account account{ 1 };
nano::stats stats;
nano::nlogger logger;
nano::nlogger & logger = nano::default_logger ();
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_FALSE (store->init_error ());
nano::bootstrap_ascending::account_sets sets{ stats };
Expand All @@ -142,7 +142,7 @@ TEST (account_sets, saturate_priority)
{
nano::account account{ 1 };
nano::stats stats;
nano::nlogger logger;
nano::nlogger & logger = nano::default_logger ();
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_FALSE (store->init_error ());
nano::bootstrap_ascending::account_sets sets{ stats };
Expand Down
10 changes: 5 additions & 5 deletions nano/core_test/confirmation_height.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@ TEST (confirmation_heightDeathTest, rollback_added_block)
// valgrind can be noisy with death tests
if (!nano::running_within_valgrind ())
{
nano::nlogger logger;
nano::nlogger & logger = nano::default_logger ();
auto path (nano::unique_path ());
auto store = nano::make_store (logger, path, nano::dev::constants);
ASSERT_TRUE (!store->init_error ());
Expand Down Expand Up @@ -1251,7 +1251,7 @@ TEST (confirmation_heightDeathTest, modified_chain)
// valgrind can be noisy with death tests
if (!nano::running_within_valgrind ())
{
nano::nlogger logger;
nano::nlogger & logger = nano::default_logger ();
auto path (nano::unique_path ());
auto store = nano::make_store (logger, path, nano::dev::constants);
ASSERT_TRUE (!store->init_error ());
Expand Down Expand Up @@ -1328,7 +1328,7 @@ TEST (confirmation_heightDeathTest, modified_chain_account_removed)
// valgrind can be noisy with death tests
if (!nano::running_within_valgrind ())
{
nano::nlogger logger;
nano::nlogger & logger = nano::default_logger ();
auto path (nano::unique_path ());
auto store = nano::make_store (logger, path, nano::dev::constants);
ASSERT_TRUE (!store->init_error ());
Expand Down Expand Up @@ -2039,7 +2039,7 @@ TEST (confirmation_height, unbounded_block_cache_iteration)
// Don't test this in rocksdb mode
GTEST_SKIP ();
}
nano::nlogger logger;
nano::nlogger & logger = nano::default_logger ();
auto path (nano::unique_path ());
auto store = nano::make_store (logger, path, nano::dev::constants);
ASSERT_TRUE (!store->init_error ());
Expand Down Expand Up @@ -2102,7 +2102,7 @@ TEST (confirmation_height, unbounded_block_cache_iteration)

TEST (confirmation_height, pruned_source)
{
nano::nlogger logger;
nano::nlogger & logger = nano::default_logger ();
auto path (nano::unique_path ());
auto store = nano::make_store (logger, path, nano::dev::constants);
ASSERT_TRUE (!store->init_error ());
Expand Down
2 changes: 1 addition & 1 deletion nano/core_test/core_test_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void force_nano_dev_network ();

GTEST_API_ int main (int argc, char ** argv)
{
nano::logging::initialize (nano::logging::config::tests_default ());
nano::initialize_logging ();
nano::set_file_descriptor_limit (OPEN_FILE_DESCRIPTORS_LIMIT);
nano::force_nano_dev_network ();
nano::node_singleton_memory_pool_purge_guard memory_pool_cleanup_guard;
Expand Down
24 changes: 12 additions & 12 deletions nano/core_test/ledger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ TEST (ledger, representation)

TEST (ledger, double_open)
{
nano::nlogger logger;
nano::nlogger & logger = nano::default_logger ();
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_TRUE (!store->init_error ());
nano::stats stats;
Expand Down Expand Up @@ -4162,7 +4162,7 @@ TEST (ledger, block_hash_account_conflict)

TEST (ledger, could_fit)
{
nano::nlogger logger;
nano::nlogger & logger = nano::default_logger ();
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_TRUE (!store->init_error ());
nano::stats stats;
Expand Down Expand Up @@ -4800,7 +4800,7 @@ TEST (ledger, dependents_confirmed)

TEST (ledger, dependents_confirmed_pruning)
{
nano::nlogger logger;
nano::nlogger & logger = nano::default_logger ();
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_FALSE (store->init_error ());
nano::stats stats;
Expand Down Expand Up @@ -4990,7 +4990,7 @@ TEST (ledger, cache)

TEST (ledger, pruning_action)
{
nano::nlogger logger;
nano::nlogger & logger = nano::default_logger ();
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_TRUE (!store->init_error ());
nano::stats stats;
Expand Down Expand Up @@ -5074,7 +5074,7 @@ TEST (ledger, pruning_action)

TEST (ledger, pruning_large_chain)
{
nano::nlogger logger;
nano::nlogger & logger = nano::default_logger ();
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_TRUE (!store->init_error ());
nano::stats stats;
Expand Down Expand Up @@ -5129,7 +5129,7 @@ TEST (ledger, pruning_large_chain)

TEST (ledger, pruning_source_rollback)
{
nano::nlogger logger;
nano::nlogger & logger = nano::default_logger ();
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_TRUE (!store->init_error ());
nano::stats stats;
Expand Down Expand Up @@ -5217,7 +5217,7 @@ TEST (ledger, pruning_source_rollback)

TEST (ledger, pruning_source_rollback_legacy)
{
nano::nlogger logger;
nano::nlogger & logger = nano::default_logger ();
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_TRUE (!store->init_error ());
nano::stats stats;
Expand Down Expand Up @@ -5330,7 +5330,7 @@ TEST (ledger, pruning_source_rollback_legacy)

TEST (ledger, pruning_process_error)
{
nano::nlogger logger;
nano::nlogger & logger = nano::default_logger ();
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_TRUE (!store->init_error ());
nano::stats stats;
Expand Down Expand Up @@ -5377,7 +5377,7 @@ TEST (ledger, pruning_process_error)

TEST (ledger, pruning_legacy_blocks)
{
nano::nlogger logger;
nano::nlogger & logger = nano::default_logger ();
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_TRUE (!store->init_error ());
nano::stats stats;
Expand Down Expand Up @@ -5463,7 +5463,7 @@ TEST (ledger, pruning_legacy_blocks)

TEST (ledger, pruning_safe_functions)
{
nano::nlogger logger;
nano::nlogger & logger = nano::default_logger ();
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_TRUE (!store->init_error ());
nano::stats stats;
Expand Down Expand Up @@ -5524,7 +5524,7 @@ TEST (ledger, pruning_safe_functions)

TEST (ledger, hash_root_random)
{
nano::nlogger logger;
nano::nlogger & logger = nano::default_logger ();
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_TRUE (!store->init_error ());
nano::stats stats;
Expand Down Expand Up @@ -5588,7 +5588,7 @@ TEST (ledger, migrate_lmdb_to_rocksdb)
{
nano::test::system system{};
auto path = nano::unique_path ();
nano::nlogger logger;
nano::nlogger & logger = nano::default_logger ();
boost::asio::ip::address_v6 address (boost::asio::ip::make_address_v6 ("::ffff:127.0.0.1"));
uint16_t port = 100;
nano::store::lmdb::component store{ logger, path / "data.ldb", nano::dev::constants };
Expand Down
2 changes: 1 addition & 1 deletion nano/core_test/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3300,7 +3300,7 @@ TEST (node, dont_write_lock_node)
std::promise<void> write_lock_held_promise;
std::promise<void> finished_promise;
std::thread ([&path, &write_lock_held_promise, &finished_promise] () {
nano::nlogger logger;
nano::nlogger & logger = nano::default_logger ();
auto store = nano::make_store (logger, path, nano::dev::constants, false, true);
{
nano::ledger_cache ledger_cache;
Expand Down
4 changes: 2 additions & 2 deletions nano/core_test/processor_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

TEST (processor_service, bad_send_signature)
{
nano::nlogger logger;
nano::nlogger & logger = nano::default_logger ();
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_FALSE (store->init_error ());
nano::stats stats;
Expand All @@ -37,7 +37,7 @@ TEST (processor_service, bad_send_signature)

TEST (processor_service, bad_receive_signature)
{
nano::nlogger logger;
nano::nlogger & logger = nano::default_logger ();
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
ASSERT_FALSE (store->init_error ());
nano::stats stats;
Expand Down
3 changes: 1 addition & 2 deletions nano/core_test/work_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,13 @@ TEST (work, cancel_many)

TEST (work, opencl)
{
nano::nlogger logger;
bool error (false);
nano::opencl_environment environment (error);
ASSERT_TRUE (!error || !nano::opencl_loaded);
if (!environment.platforms.empty () && !environment.platforms.begin ()->devices.empty ())
{
nano::opencl_config config (0, 0, 16 * 1024);
auto opencl (nano::opencl_work::create (true, config, logger, nano::dev::network_params.work));
auto opencl (nano::opencl_work::create (true, config, nano::default_logger (), nano::dev::network_params.work));
if (opencl != nullptr)
{
// 0 threads, should add 1 for managing OpenCL
Expand Down
2 changes: 1 addition & 1 deletion nano/load_test/entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ account_info account_info_rpc (boost::asio::io_context & ioc, tcp::resolver::res
/** This launches a node and fires a lot of send/recieve RPC requests at it (configurable), then other nodes are tested to make sure they observe these blocks as well. */
int main (int argc, char * const * argv)
{
nano::logging::initialize (nano::logging::config::tests_default ());
nano::initialize_logging ();
nano::force_nano_dev_network ();

boost::program_options::options_description description ("Command line options");
Expand Down
2 changes: 1 addition & 1 deletion nano/rpc_test/entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ void force_nano_dev_network ();

int main (int argc, char ** argv)
{
nano::logging::initialize (nano::logging::config::tests_default ());
nano::initialize_logging ();
nano::force_nano_dev_network ();
nano::set_use_memory_pools (false);
nano::node_singleton_memory_pool_purge_guard cleanup_guard;
Expand Down
2 changes: 1 addition & 1 deletion nano/slow_test/entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void force_nano_dev_network ();

int main (int argc, char ** argv)
{
nano::logging::initialize (nano::logging::config::tests_default ());
nano::initialize_logging ();
nano::force_nano_dev_network ();
nano::node_singleton_memory_pool_purge_guard memory_pool_cleanup_guard;
testing::InitGoogleTest (&argc, argv);
Expand Down
2 changes: 1 addition & 1 deletion nano/test_common/ledger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <nano/test_common/ledger.hpp>

nano::test::context::ledger_context::ledger_context (std::deque<std::shared_ptr<nano::block>> && blocks) :
store_m{ nano::make_store (nlogger, nano::unique_path (), nano::dev::constants) },
store_m{ nano::make_store (nano::default_logger (), nano::unique_path (), nano::dev::constants) },
ledger_m{ *store_m, stats_m, nano::dev::constants },
blocks_m{ blocks }
{
Expand Down
1 change: 0 additions & 1 deletion nano/test_common/ledger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ namespace test
std::deque<std::shared_ptr<nano::block>> const & blocks () const;

private:
nano::nlogger nlogger;
std::unique_ptr<nano::store::component> store_m;
nano::stats stats_m;
nano::ledger ledger_m;
Expand Down

0 comments on commit a5fb250

Please sign in to comment.