Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RocksDB tests #2836

Merged
merged 19 commits into from
Sep 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
48 changes: 48 additions & 0 deletions .github/workflows/rocksdb_release_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: RocksDB Release Tests

on:
push:
tags: '*'

env:
RELEASE: 1
artifact: 0
TEST_USE_ROCKSDB: 1

jobs:
osx_test:
runs-on: macOS-latest
env:
BOOST_ROOT: /tmp/boost
steps:
- uses: actions/checkout@722adc6
- name: Checkout Submodules
run: git submodule update --init --recursive
- name: Fetch Deps
run: TEST=1 ci/actions/osx/install_deps.sh
- name: Run Tests
run: ci/build-travis.sh "/tmp/qt/lib/cmake/Qt5";

gcc_test:
runs-on: ubuntu-18.04
timeout-minutes: 60
steps:
- uses: actions/checkout@722adc6
- name: Checkout Submodules
run: git submodule update --init --recursive
- name: Fetch Deps
run: ci/actions/linux/install_deps.sh
- name: Run Tests
run: docker run -e TEST_USE_ROCKSDB -v ${PWD}:/workspace nanocurrency/nano-env:gcc /bin/bash -c "cd /workspace && export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/boost/lib && ldconfig && RELEASE=1 ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}"

clang_test:
runs-on: ubuntu-18.04
timeout-minutes: 60
steps:
- uses: actions/checkout@722adc6
- name: Checkout Submodules
run: git submodule update --init --recursive
- name: Fetch Deps
run: ci/actions/linux/install_deps.sh
- name: Run Tests
run: docker run -e TEST_USE_ROCKSDB -v ${PWD}:/workspace nanocurrency/nano-env:clang-6 /bin/bash -c "cd /workspace && export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/boost/lib && ldconfig && RELEASE=1 ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}"
64 changes: 64 additions & 0 deletions .github/workflows/rocksdb_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: RocksDB Tests

on: [push, pull_request]

env:
RELEASE: 0
artifact: 0
TEST_USE_ROCKSDB: 1

jobs:
osx_test:
runs-on: macOS-latest
env:
BOOST_ROOT: /tmp/boost
DEADLINE_SCALE_FACTOR: 2
steps:
- uses: actions/checkout@722adc6
- name: Checkout Submodules
run: git submodule update --init --recursive
- name: Fetch Deps
run: TEST=1 ci/actions/osx/install_deps.sh
- name: Run Tests
run: ci/build-travis.sh "/tmp/qt/lib/cmake/Qt5";

gcc_test:
runs-on: ubuntu-18.04
timeout-minutes: 60
steps:
- uses: actions/checkout@722adc6
- name: Checkout Submodules
run: git submodule update --init --recursive
- name: Fetch Deps
run: ci/actions/linux/install_deps.sh
- name: Run Tests
run: docker run -e TEST_USE_ROCKSDB -v ${PWD}:/workspace nanocurrency/nano-env:gcc /bin/bash -c "cd /workspace && export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/boost/lib && ldconfig && ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}"

clang_test:
runs-on: ubuntu-18.04
timeout-minutes: 60
steps:
- uses: actions/checkout@722adc6
- name: Checkout Submodules
run: git submodule update --init --recursive
- name: Fetch Deps
run: ci/actions/linux/install_deps.sh
- name: Run Tests
run: docker run -e TEST_USE_ROCKSDB -v ${PWD}:/workspace nanocurrency/nano-env:clang-6 /bin/bash -c "cd /workspace && export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/boost/lib && ldconfig && ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}"

windows_test:
runs-on: windows-latest
timeout-minutes: 60
env:
RELEASE: 1
DEADLINE_SCALE_FACTOR: 2
steps:
- uses: actions/checkout@722adc6
- name: Windows Defender
run: ci/actions/windows/disable_windows_defender.ps1
- name: Checkout Submodules
run: git submodule update --init --recursive
- name: Fetch Deps
run: ci/actions/windows/install_deps.ps1
- name: Run Tests
run: ci/actions/windows/build.ps1
6 changes: 5 additions & 1 deletion ci/test.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#!/usr/bin/env bash

build_dir=${1-${PWD}}
TIMEOUT_DEFAULT=360
if [[ ${TEST_USE_ROCKSDB-0} == 1 ]]; then
TIMEOUT_DEFAULT=720
else
TIMEOUT_DEFAULT=360
fi

BUSYBOX_BASH=${BUSYBOX_BASH-0}

Expand Down
55 changes: 55 additions & 0 deletions nano/core_test/block_store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,11 @@ TEST (bootstrap, simple)

TEST (unchecked, multiple)
{
if (nano::using_rocksdb_in_tests ())
{
// Don't test this in rocksdb mode
return;
}
nano::logger_mt logger;
auto store = nano::make_store (logger, nano::unique_path ());
ASSERT_TRUE (!store->init_error ());
Expand Down Expand Up @@ -654,6 +659,11 @@ TEST (block_store, latest_find)

TEST (mdb_block_store, supported_version_upgrades)
{
if (nano::using_rocksdb_in_tests ())
{
// Don't test this in rocksdb mode
return;
}
// Check that upgrading from an unsupported version is not supported
auto path (nano::unique_path ());
nano::genesis genesis;
Expand Down Expand Up @@ -700,6 +710,11 @@ TEST (mdb_block_store, supported_version_upgrades)

TEST (mdb_block_store, bad_path)
{
if (nano::using_rocksdb_in_tests ())
{
// Don't test this in rocksdb mode
return;
}
nano::logger_mt logger;
nano::mdb_store store (logger, boost::filesystem::path ("///"));
ASSERT_TRUE (store.init_error ());
Expand Down Expand Up @@ -1027,6 +1042,11 @@ TEST (block_store, state_block)

TEST (mdb_block_store, sideband_height)
{
if (nano::using_rocksdb_in_tests ())
{
// Don't test this in rocksdb mode
return;
}
nano::logger_mt logger;
nano::genesis genesis;
nano::keypair key1;
Expand Down Expand Up @@ -1214,6 +1234,11 @@ TEST (block_store, online_weight)

TEST (mdb_block_store, upgrade_v14_v15)
{
if (nano::using_rocksdb_in_tests ())
{
// Don't test this in rocksdb mode
return;
}
// Extract confirmation height to a separate database
auto path (nano::unique_path ());
nano::genesis genesis;
Expand Down Expand Up @@ -1322,6 +1347,11 @@ TEST (mdb_block_store, upgrade_v14_v15)

TEST (mdb_block_store, upgrade_v15_v16)
{
if (nano::using_rocksdb_in_tests ())
{
// Don't test this in rocksdb mode
return;
}
auto path (nano::unique_path ());
nano::mdb_val value;
{
Expand Down Expand Up @@ -1363,6 +1393,11 @@ TEST (mdb_block_store, upgrade_v15_v16)

TEST (mdb_block_store, upgrade_v16_v17)
{
if (nano::using_rocksdb_in_tests ())
{
// Don't test this in rocksdb mode
return;
}
nano::genesis genesis;
nano::work_pool pool (std::numeric_limits<unsigned>::max ());
nano::state_block block1 (nano::dev_genesis_key.pub, genesis.hash (), nano::dev_genesis_key.pub, nano::genesis_amount - nano::Gxrb_ratio, nano::dev_genesis_key.pub, nano::dev_genesis_key.prv, nano::dev_genesis_key.pub, *pool.generate (genesis.hash ()));
Expand Down Expand Up @@ -1422,6 +1457,11 @@ TEST (mdb_block_store, upgrade_v16_v17)

TEST (mdb_block_store, upgrade_v17_v18)
{
if (nano::using_rocksdb_in_tests ())
{
// Don't test this in rocksdb mode
return;
}
auto path (nano::unique_path ());
nano::genesis genesis;
nano::keypair key1;
Expand Down Expand Up @@ -1621,6 +1661,11 @@ TEST (mdb_block_store, upgrade_v17_v18)

TEST (mdb_block_store, upgrade_v18_v19)
{
if (nano::using_rocksdb_in_tests ())
{
// Don't test this in rocksdb mode
return;
}
auto path (nano::unique_path ());
nano::keypair key1;
nano::work_pool pool (std::numeric_limits<unsigned>::max ());
Expand Down Expand Up @@ -1709,6 +1754,11 @@ TEST (mdb_block_store, upgrade_v18_v19)

TEST (mdb_block_store, upgrade_backup)
{
if (nano::using_rocksdb_in_tests ())
{
// Don't test this in rocksdb mode
return;
}
auto dir (nano::unique_path ());
namespace fs = boost::filesystem;
fs::create_directory (dir);
Expand Down Expand Up @@ -1746,6 +1796,11 @@ TEST (mdb_block_store, upgrade_backup)
// Test various confirmation height values as well as clearing them
TEST (block_store, confirmation_height)
{
if (nano::using_rocksdb_in_tests ())
{
// Don't test this in rocksdb mode
return;
}
auto path (nano::unique_path ());
nano::logger_mt logger;
auto store = nano::make_store (logger, path);
Expand Down
20 changes: 20 additions & 0 deletions nano/core_test/confirmation_height.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,11 @@ TEST (confirmation_height, conflict_rollback_cemented)

TEST (confirmation_heightDeathTest, rollback_added_block)
{
if (nano::using_rocksdb_in_tests ())
{
// Don't test this in rocksdb mode
return;
}
// For ASSERT_DEATH_IF_SUPPORTED
testing::FLAGS_gtest_death_test_style = "threadsafe";

Expand Down Expand Up @@ -801,6 +806,11 @@ TEST (confirmation_height, observers)
// This tests when a read has been done, but the block no longer exists by the time a write is done
TEST (confirmation_heightDeathTest, modified_chain)
{
if (nano::using_rocksdb_in_tests ())
{
// Don't test this in rocksdb mode
return;
}
// For ASSERT_DEATH_IF_SUPPORTED
testing::FLAGS_gtest_death_test_style = "threadsafe";

Expand Down Expand Up @@ -867,6 +877,11 @@ TEST (confirmation_heightDeathTest, modified_chain)
// This tests when a read has been done, but the account no longer exists by the time a write is done
TEST (confirmation_heightDeathTest, modified_chain_account_removed)
{
if (nano::using_rocksdb_in_tests ())
{
// Don't test this in rocksdb mode
return;
}
// For ASSERT_DEATH_IF_SUPPORTED
testing::FLAGS_gtest_death_test_style = "threadsafe";

Expand Down Expand Up @@ -1383,6 +1398,11 @@ TEST (confirmation_height, election_winner_details_clearing_node_process_confirm

TEST (confirmation_height, unbounded_block_cache_iteration)
{
if (nano::using_rocksdb_in_tests ())
{
// Don't test this in rocksdb mode
return;
}
nano::logger_mt logger;
auto path (nano::unique_path ());
auto store = nano::make_store (logger, path);
Expand Down
5 changes: 5 additions & 0 deletions nano/core_test/ledger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ using namespace std::chrono_literals;
// Init returns an error if it can't open files at the path
TEST (ledger, store_error)
{
if (nano::using_rocksdb_in_tests ())
{
// Don't test this in rocksdb mode
return;
}
nano::logger_mt logger;
nano::mdb_store store (logger, boost::filesystem::path ("///"));
ASSERT_TRUE (store.init_error ());
Expand Down
11 changes: 7 additions & 4 deletions nano/core_test/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ TEST (node_DeathTest, readonly_block_store_not_exist)
#endif
{
// This is a read-only node with no ledger file
#if NANO_ROCKSDB
if (nano::using_rocksdb_in_tests ())
{
nano::inactive_node node (nano::unique_path (), nano::inactive_node_flag_defaults ());
Expand All @@ -83,9 +82,6 @@ TEST (node_DeathTest, readonly_block_store_not_exist)
{
ASSERT_EXIT (nano::inactive_node node (nano::unique_path (), nano::inactive_node_flag_defaults ()), ::testing::ExitedWithCode (1), "");
}
#else
ASSERT_EXIT (nano::inactive_node node (nano::unique_path (), nano::inactive_node_flag_defaults ()), ::testing::ExitedWithCode (1), "");
#endif
}

TEST (node, password_fanout)
Expand Down Expand Up @@ -3686,6 +3682,13 @@ TEST (node, dont_write_lock_node)

TEST (node, bidirectional_tcp)
{
#ifdef _WIN32
if (nano::using_rocksdb_in_tests ())
{
// Don't test this in rocksdb mode
return;
}
#endif
nano::system system;
nano::node_flags node_flags;
// Disable bootstrap to start elections for new blocks
Expand Down
5 changes: 5 additions & 0 deletions nano/qt_test/qt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,11 @@ TEST (wallet, create_change)

TEST (history, short_text)
{
if (nano::using_rocksdb_in_tests ())
{
// Don't test this in rocksdb mode
return;
}
nano_qt::eventloop_processor processor;
nano::keypair key;
nano::system system (1);
Expand Down
5 changes: 2 additions & 3 deletions nano/rpc_test/rpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6751,10 +6751,9 @@ TEST (rpc, block_confirmed)

TEST (rpc, database_txn_tracker)
{
// Don't test this with the rocksdb backend
auto use_rocksdb_str = std::getenv ("TEST_USE_ROCKSDB");
if (use_rocksdb_str && boost::lexical_cast<int> (use_rocksdb_str) == 1)
if (nano::using_rocksdb_in_tests ())
{
// Don't test this in rocksdb mode
return;
}

Expand Down
5 changes: 5 additions & 0 deletions nano/slow_test/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,11 @@ TEST (confirmation_height, many_accounts_send_receive_self)
// as opposed to active transactions which implicitly calls confirmation height processor.
TEST (confirmation_height, many_accounts_send_receive_self_no_elections)
{
if (nano::using_rocksdb_in_tests ())
{
// Don't test this in rocksdb mode
return;
}
nano::logger_mt logger;
auto path (nano::unique_path ());
auto store = nano::make_store (logger, path);
Expand Down