Skip to content

Commit

Permalink
hived_fixture should override shared-file-size setting if explicit va…
Browse files Browse the repository at this point in the history
…lue was not specified at fixture configuration (to avoid using hived default: 24G)
  • Loading branch information
vogel76 committed Sep 27, 2024
1 parent 876cb35 commit eb0ae00
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions tests/unit/db_fixture/hived_fixture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ void hived_fixture::set_logging_config( const fc::optional< fc::logging_config >
}
}

void hived_fixture::postponed_init_impl( bool remove_db_files,
const config_arg_override_t& config_arg_overrides )
void hived_fixture::postponed_init_impl( bool remove_db_files, config_arg_override_t config_arg_overrides )
{
try
{
Expand All @@ -77,6 +76,14 @@ void hived_fixture::postponed_init_impl( bool remove_db_files,
{ "rc-stats-report-type", { "NONE" } }
};

if (std::find_if(config_arg_overrides.cbegin(), config_arg_overrides.cend(),
[=](const config_arg_override_t::value_type& item) -> bool { return item.first == "shared-file-size"; }) == config_arg_overrides.cend())
{
/// By default limit shm size to 64MB for unit tests.
config_arg_overrides.emplace_back(config_arg_override_t::value_type(
{ "shared-file-size", { std::to_string(1024 * 1024 * hived_fixture::shared_file_size_in_mb_64) } }));
}

if( not config_arg_overrides.empty() )
std::copy_if( config_arg_overrides.begin(),
config_arg_overrides.end(),
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/db_fixture/hived_fixture.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ struct hived_fixture : public database_fixture
bool push_block( const std::shared_ptr<full_block_type>& b, uint32_t skip_flags = 0 );

private:
void postponed_init_impl( bool remove_db_files, const config_arg_override_t& config_arg_overrides );
void postponed_init_impl( bool remove_db_files, config_arg_override_t config_arg_overrides );
private:
hive::plugins::chain::chain_plugin* _chain = nullptr;
const hive::chain::block_read_i* _block_reader = nullptr;
Expand Down

0 comments on commit eb0ae00

Please sign in to comment.