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

fix: ensure correct handling of mock endpoints #228

Merged
merged 1 commit into from
Feb 28, 2024
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
7 changes: 6 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ Checks: '
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
readability-*,
google-explicit-constructor,
-readability-identifier-length'
-readability-identifier-length,
-cppcoreguidelines-avoid-const-or-ref-data-members,
-bugprone-unchecked-optional-access,
-cppcoreguidelines-avoid-do-while,
-modernize-use-emplace,
-readability-convert-member-functions-to-static'
HalosGhost marked this conversation as resolved.
Show resolved Hide resolved
CheckOptions:
- {key: cppcoreguidelines-explicit-virtual-functions.AllowOverrideAndFinal, value: true}
- {key: modernize-use-override.AllowOverrideAndFinal, value: true}
Expand Down
47 changes: 30 additions & 17 deletions tests/integration/mock_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,42 @@ namespace cbdc::test {
const std::unordered_set<mock_system_module>& disabled_modules,
config::options opts)
: m_opts(std::move(opts)) {
m_module_endpoints.insert({mock_system_module::watchtower,
m_opts.m_watchtower_internal_endpoints});
if(!m_opts.m_watchtower_internal_endpoints.empty()) {
m_module_endpoints.emplace(mock_system_module::watchtower,
m_opts.m_watchtower_internal_endpoints);
}

if(!m_opts.m_atomizer_endpoints.empty()) {
m_module_endpoints.emplace(mock_system_module::atomizer,
m_opts.m_atomizer_endpoints);
}

m_module_endpoints.insert(
{mock_system_module::atomizer, m_opts.m_atomizer_endpoints});
if(!m_opts.m_coordinator_endpoints.empty()) {
auto coord_eps = std::vector<network::endpoint_t>();
for(const auto& node_eps : m_opts.m_coordinator_endpoints) {
coord_eps.insert(coord_eps.end(),
node_eps.begin(),
node_eps.end());
}

auto coord_eps = std::vector<network::endpoint_t>();
for(const auto& node_eps : m_opts.m_coordinator_endpoints) {
coord_eps.insert(coord_eps.end(),
node_eps.begin(),
node_eps.end());
m_module_endpoints.emplace(mock_system_module::coordinator,
coord_eps);
}
m_module_endpoints.insert(
{mock_system_module::coordinator, coord_eps});

m_module_endpoints.insert(
{mock_system_module::archiver, m_opts.m_archiver_endpoints});
if(!m_opts.m_archiver_endpoints.empty()) {
m_module_endpoints.emplace(mock_system_module::archiver,
m_opts.m_archiver_endpoints);
}

m_module_endpoints.insert(
{mock_system_module::shard, m_opts.m_shard_endpoints});
if(!m_opts.m_shard_endpoints.empty()) {
m_module_endpoints.emplace(mock_system_module::shard,
m_opts.m_shard_endpoints);
}

m_module_endpoints.insert(
{mock_system_module::sentinel, m_opts.m_sentinel_endpoints});
if(!m_opts.m_sentinel_endpoints.empty()) {
m_module_endpoints.emplace(mock_system_module::sentinel,
m_opts.m_sentinel_endpoints);
}

for(const auto& m : disabled_modules) {
m_module_endpoints.erase(m);
Expand Down
Loading