end
]])
+Note that this version, like the one above, returns the index (starting at 0) of the server to select.
+It was initially not possible to indicate that all servers were unavailable from these policies, but
+since 1.9.2 returning a value equal or greater than the number of servers will be interpreted as such.
+
ServerPolicy Objects
--------------------
}
BOOST_AUTO_TEST_CASE(test_lua_ffi_no_server_available) {
- DNSName name("powerdns.com.");
+ DNSName dnsName("powerdns.com.");
static const std::string policySetupStr = R"foo(
local ffi = require("ffi")
local C = ffi.C
)foo";
resetLuaContext();
g_lua.lock()->executeCode(getLuaFFIWrappers());
- g_lua.lock()->writeFunction("setServerPolicyLuaFFI", [](string name, ServerPolicy::ffipolicyfunc_t policy) {
- g_policy.setState(ServerPolicy(name, policy));
+ g_lua.lock()->writeFunction("setServerPolicyLuaFFI", [](string policyName, ServerPolicy::ffipolicyfunc_t policy) {
+ g_policy.setState(ServerPolicy(policyName, policy));
});
g_lua.lock()->executeCode(policySetupStr);
}
BOOST_REQUIRE_EQUAL(servers.size(), 10U);
- auto dq = getDQ(&name);
+ auto dq = getDQ(&dnsName);
auto server = pol.getSelectedBackend(servers, dq);
BOOST_REQUIRE(server == nullptr);
}