1 parent
9a54f15e7e
commit
f94366104e
7 files changed
+100
-13
No files matched your search
@@ -67,4 +67,29 @@ Void::Testing::Test configure_skipped_without_provider()
|
||||
Void::Testing::expect_eq(configurable(h)->configure_calls(), 0);
|
||||
}
|
||||
|
||||
Void::Testing::Test activation_failure_keeps_current_instance()
|
||||
{
|
||||
Void::FileSystem::TempDir tmp{"void_cfg_ready"};
|
||||
const auto so = tmp.path() / "plugin.so";
|
||||
std::filesystem::copy_file(VOID_CONFIGURABLE_PATH, so);
|
||||
|
||||
std::string payload{"accepted"};
|
||||
PluginManager mgr{{.config_provider = [&payload](std::string_view) {
|
||||
return payload;
|
||||
}}};
|
||||
Void::Testing::expect(mgr.load(so).has_value());
|
||||
auto before = mgr.acquire("ConfigurablePlugin");
|
||||
Void::Testing::expect_eq(configurable(before)->last_config(),
|
||||
std::string_view{"accepted"});
|
||||
|
||||
payload = "reject";
|
||||
const auto result = mgr.reload("ConfigurablePlugin");
|
||||
Void::Testing::expect(!result.has_value());
|
||||
Void::Testing::expect(result.error() == LoadError::ActivationFailed);
|
||||
auto after = mgr.acquire("ConfigurablePlugin");
|
||||
Void::Testing::expect(after.get() == before.get());
|
||||
Void::Testing::expect_eq(configurable(after)->last_config(),
|
||||
std::string_view{"accepted"});
|
||||
}
|
||||
|
||||
#endif // configurable plugin available
|
||||
Reference in new issue
Block a user