Skip to content

Commit 5a27df9

Browse files
committed
Test all config via the connect method
1 parent e4f6cc0 commit 5a27df9

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

t/config.t

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ GET /t
8787
[error]
8888

8989

90-
=== TEST 4: Unknown config keys should return an error
90+
=== TEST 4: Unknown config errors, all config does not
9191
--- http_config eval: $::HttpConfig
9292
--- config
9393
location /t {
@@ -102,29 +102,51 @@ location /t {
102102
assert(rc == nil, "rc should be nil")
103103
assert(err == "field foo does not exist", "err should contain error")
104104

105-
106105
-- Provide all options, without errors
107106

108107
assert(require("resty.redis.connector").new({
109108
connect_timeout = 100,
110109
read_timeout = 1000,
111-
connection_options = {},
110+
connection_options = { pool = "<host>::<port>" },
112111
keepalive_timeout = 60000,
113112
keepalive_poolsize = 30,
114113

115114
host = "127.0.0.1",
116115
port = 6379,
117-
path = "", -- /tmp/redis.sock
116+
path = "",
118117
password = "",
119118
db = 0,
120119

121-
url = "", -- DSN url
120+
url = "",
122121

123122
master_name = "mymaster",
124-
role = "master", -- master | slave | any
123+
role = "master",
125124
sentinels = {},
126125
}), "new should return positively")
127126

127+
-- Provide all options via connect, without errors
128+
129+
local rc = require("resty.redis.connector").new()
130+
131+
assert(rc:connect({
132+
connect_timeout = 100,
133+
read_timeout = 1000,
134+
connection_options = { pool = "<host>::<port>" },
135+
keepalive_timeout = 60000,
136+
keepalive_poolsize = 30,
137+
138+
host = "127.0.0.1",
139+
port = 6379,
140+
path = "",
141+
password = "",
142+
db = 0,
143+
144+
url = "",
145+
146+
master_name = "mymaster",
147+
role = "master",
148+
sentinels = {},
149+
}), "rc:connect should return positively")
128150
}
129151
}
130152
--- request

0 commit comments

Comments
 (0)