Permalink
Browse files

tests: added a passing test for the connection refused error case (#106

…).
  • Loading branch information...
agentzh committed Dec 27, 2016
1 parent bd06e72 commit b18966e4a079d391bea7d3fb715782cb33e2e29b
Showing with 31 additions and 0 deletions.
  1. +31 −0 t/sanity.t
View
@@ -827,3 +827,34 @@ a_dog: an animal
a_dog: an animal
--- no_error_log
[error]
=== TEST 15: connection refused
--- http_config eval: $::HttpConfig
--- config
location /t {
content_by_lua '
local redis = require "resty.redis"
local red = redis:new()
red:set_timeout(10000) -- 10 sec
local ok, err = red:connect("127.0.0.1", 81)
if not ok then
ngx.say("failed to connect: ", err)
return
end
ngx.say("connected")
red:close()
';
}
--- request
GET /t
--- response_body
failed to connect: connection refused
--- timeout: 3
--- no_error_log
[alert]

0 comments on commit b18966e

Please sign in to comment.