summaryrefslogtreecommitdiff
path: root/t/proxyconfig.lua
diff options
context:
space:
mode:
Diffstat (limited to 't/proxyconfig.lua')
-rw-r--r--t/proxyconfig.lua17
1 files changed, 16 insertions, 1 deletions
diff --git a/t/proxyconfig.lua b/t/proxyconfig.lua
index 18a35de..5f9ad0e 100644
--- a/t/proxyconfig.lua
+++ b/t/proxyconfig.lua
@@ -2,6 +2,8 @@
-- so we can modify ourselves.
local mode = dofile("/tmp/proxyconfigmode.lua")
+mcp.backend_read_timeout(4)
+
function mcp_config_pools(old)
if mode == "none" then
return {}
@@ -14,6 +16,19 @@ function mcp_config_pools(old)
test = mcp.pool({b1, b2, b3})
}
return pools
+ elseif mode == "betable" then
+ local b1 = mcp.backend({ label = "b1", host = "127.0.0.1", port = 11511,
+ connecttimeout = 2, retrytimeout = 5, readtimeout = 0.1,
+ failurelimit = 0 })
+ local b2 = mcp.backend({ label = "b2", host = "127.0.0.1", port = 11512,
+ connecttimeout = 2, retrytimeout = 5, readtimeout = 5 })
+ local b3 = mcp.backend({ label = "b3", host = "127.0.0.1", port = 11513,
+ connecttimeout = 5, retrytimeout = 5, readtimeout = 5 })
+
+ local pools = {
+ test = mcp.pool({b1, b2, b3})
+ }
+ return pools
end
end
@@ -24,7 +39,7 @@ function mcp_config_routes(zones)
if mode == "none" then
mcp.attach(mcp.CMD_MG, function(r) return "SERVER_ERROR no mg route\r\n" end)
mcp.attach(mcp.CMD_MS, function(r) return "SERVER_ERROR no ms route\r\n" end)
- elseif mode == "start" then
+ elseif mode == "start" or mode == "betable" then
mcp.attach(mcp.CMD_MG, function(r) return zones["test"](r) end)
mcp.attach(mcp.CMD_MS, function(r) return zones["test"](r) end)
end