Skip to content

Commit eb0ae00

Browse files
committed
hived_fixture should override shared-file-size setting if explicit value was not specified at fixture configuration (to avoid using hived default: 24G)
1 parent 876cb35 commit eb0ae00

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

tests/unit/db_fixture/hived_fixture.cpp

+9-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ void hived_fixture::set_logging_config( const fc::optional< fc::logging_config >
5353
}
5454
}
5555

56-
void hived_fixture::postponed_init_impl( bool remove_db_files,
57-
const config_arg_override_t& config_arg_overrides )
56+
void hived_fixture::postponed_init_impl( bool remove_db_files, config_arg_override_t config_arg_overrides )
5857
{
5958
try
6059
{
@@ -77,6 +76,14 @@ void hived_fixture::postponed_init_impl( bool remove_db_files,
7776
{ "rc-stats-report-type", { "NONE" } }
7877
};
7978

79+
if (std::find_if(config_arg_overrides.cbegin(), config_arg_overrides.cend(),
80+
[=](const config_arg_override_t::value_type& item) -> bool { return item.first == "shared-file-size"; }) == config_arg_overrides.cend())
81+
{
82+
/// By default limit shm size to 64MB for unit tests.
83+
config_arg_overrides.emplace_back(config_arg_override_t::value_type(
84+
{ "shared-file-size", { std::to_string(1024 * 1024 * hived_fixture::shared_file_size_in_mb_64) } }));
85+
}
86+
8087
if( not config_arg_overrides.empty() )
8188
std::copy_if( config_arg_overrides.begin(),
8289
config_arg_overrides.end(),

tests/unit/db_fixture/hived_fixture.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ struct hived_fixture : public database_fixture
7171
bool push_block( const std::shared_ptr<full_block_type>& b, uint32_t skip_flags = 0 );
7272

7373
private:
74-
void postponed_init_impl( bool remove_db_files, const config_arg_override_t& config_arg_overrides );
74+
void postponed_init_impl( bool remove_db_files, config_arg_override_t config_arg_overrides );
7575
private:
7676
hive::plugins::chain::chain_plugin* _chain = nullptr;
7777
const hive::chain::block_read_i* _block_reader = nullptr;

0 commit comments

Comments
 (0)