Commit 9caa83be authored by Dominik Charousset's avatar Dominik Charousset

Fix runtime warnings when running unit tests

parent 1c12c214
...@@ -77,6 +77,9 @@ public: ...@@ -77,6 +77,9 @@ public:
/// @param name Config option name formatted as `<category>.<long-name>`. /// @param name Config option name formatted as `<category>.<long-name>`.
option_pointer qualified_name_lookup(string_view name) const; option_pointer qualified_name_lookup(string_view name) const;
/// Returns whether a @ref config_option for the given category exists.
bool has_category(string_view category) const noexcept;
/// Returns the number of stored config options. /// Returns the number of stored config options.
size_t size() const noexcept { size_t size() const noexcept {
return opts_.size(); return opts_.size();
......
...@@ -280,4 +280,11 @@ config_option_set::qualified_name_lookup(string_view name) const { ...@@ -280,4 +280,11 @@ config_option_set::qualified_name_lookup(string_view name) const {
return qualified_name_lookup(name.substr(0, sep), name.substr(sep + 1)); return qualified_name_lookup(name.substr(0, sep), name.substr(sep + 1));
} }
bool config_option_set::has_category(string_view category) const noexcept {
auto predicate = [category](const config_option& opt) {
return opt.category() == category;
};
return std::any_of(opts_.begin(), opts_.end(), predicate);
}
} // namespace caf } // namespace caf
...@@ -679,9 +679,11 @@ public: ...@@ -679,9 +679,11 @@ public:
CAF_FAIL("failed to parse config: " << to_string(err)); CAF_FAIL("failed to parse config: " << to_string(err));
cfg.set("caf.scheduler.policy", "testing"); cfg.set("caf.scheduler.policy", "testing");
cfg.set("caf.logger.inline-output", true); cfg.set("caf.logger.inline-output", true);
if (cfg.custom_options().has_category("caf.middleman")) {
cfg.set("caf.middleman.network-backend", "testing"); cfg.set("caf.middleman.network-backend", "testing");
cfg.set("caf.middleman.manual-multiplexing", true); cfg.set("caf.middleman.manual-multiplexing", true);
cfg.set("caf.middleman.workers", size_t{0}); cfg.set("caf.middleman.workers", size_t{0});
}
cfg.set("caf.stream.credit-policy", "testing"); cfg.set("caf.stream.credit-policy", "testing");
return cfg; return cfg;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment