Skip to content

Commit

Permalink
tests(*) harden a few test cases, specifically for OpenResty 1.15.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaultcha committed May 28, 2019
1 parent 2e4d01b commit e2f14cc
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
2 changes: 1 addition & 1 deletion t/06-cluster.t
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ coordinator 3: 127.0.0.1
--- request
GET /t
--- response_body_like chomp
all hosts tried for query failed\. 127\.0\.0\.\d+: host still considered down for 0\.[678]\d+s \(last error: not recorded\)\. 127\.0\.0\.\d+: host still considered down for 0\.[678]\d+s \(last error: not recorded\)\. 127\.0\.0\.\d+: host still considered down for 0\.[678]\d+s \(last error: not recorded\)
all hosts tried for query failed\. 127\.0\.0\.\d+: host still considered down for 0\.\d+s \(last error: not recorded\)\. 127\.0\.0\.\d+: host still considered down for 0\.\d+s \(last error: not recorded\)\. 127\.0\.0\.\d+: host still considered down for 0\.\d+s \(last error: not recorded\)
--- no_error_log
[error]
Expand Down
19 changes: 18 additions & 1 deletion t/14-lb_req_dc_rr.t
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,24 @@ local_dc: dc1
--- config
location /t {
content_by_lua_block {
ngx.ctx = nil
if rawget(ngx, "ctx") == nil then
-- OpenResty >= 1.15.8.1
local __ngx_index = getmetatable(ngx)
setmetatable(ngx, {
__index = function(t, k)
if k == "ctx" then
return
end
return __ngx_index(t, k)
end
})
else
-- OpenResty <= 1.13.6.2
ngx.ctx = nil
end
local req_dc_rr = require 'resty.cassandra.policies.lb.req_dc_rr'
ngx.say(req_dc_rr.name)
Expand Down
20 changes: 19 additions & 1 deletion t/15-req_rr.t
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,25 @@ req_round_robin
--- config
location /t {
content_by_lua_block {
ngx.ctx = nil
if rawget(ngx, "ctx") == nil then
-- OpenResty >= 1.15.8.1
local __ngx_index = getmetatable(ngx)
setmetatable(ngx, {
__index = function(t, k)
if k == "ctx" then
return
end
return __ngx_index(t, k)
end
})
else
-- OpenResty <= 1.13.6.2
ngx.ctx = nil
end
local lb_req_rr = require 'resty.cassandra.policies.lb.req_rr'
ngx.say(lb_req_rr.name)
Expand Down

0 comments on commit e2f14cc

Please sign in to comment.