Zero is the initial value, but until now it was only possible to pass
a value greater than or equal to 1.0 to `setWeightedBalancingFactor()`
so it was not possible to reset it to the default value.
luaCtx.writeFunction("setWeightedBalancingFactor", [](double factor) {
setLuaSideEffect();
- if (factor >= 1.0) {
+ if (factor >= 1.0 || factor == 0) {
g_weightedBalancingFactor = factor;
}
else {
_config_params = ['_testServerPort', '_testServer2Port']
_config_template = """
setServerPolicy(wrandom)
+ setWeightedBalancingFactor(1.0)
+ -- this is the default, but let's ensure we can reset it to the initial value
+ setWeightedBalancingFactor(0)
s1 = newServer{address="127.0.0.1:%s", weight=1}
s1:setUp()
s2 = newServer{address="127.0.0.1:%s", weight=2}