22
33use Test::Nginx::Socket::Lua::Stream ' no_plan' ;
44
5+ use Cwd qw( cwd) ;
6+
7+
8+ my $pwd = cwd();
9+
10+ our $StreamConfig = qq{
11+ lua_package_path "$pwd /lib/?.lua;$pwd /lib/?/init.lua;;";
12+ lua_shared_dict dogs 1m;
13+ } ;
14+
515# no_shuffle();
616run_tests();
717
818__DATA__
919=== TEST 1: Redis inline protocol simple get.
10- --- stream_config
11- lua_shared_dict dogs 1m;
20+ --- stream_config eval: $::StreamConfig
1221--- stream_server_config
1322 content_by_lua_block {
1423 ngx.shared.dogs:set("doge", "wow")
3039
3140
3241=== TEST 2: Redis inline protocol initialized without shdict, no dict arg.
33- --- stream_config
34- lua_shared_dict dogs 1m;
42+ --- stream_config eval: $::StreamConfig
3543--- stream_server_config
3644 content_by_lua_block {
3745 ngx.shared.dogs:set("doge", "wow")
5361
5462
5563=== TEST 3: Redis inline protocol initialized without shdict, has dict arg.
56- --- stream_config
57- lua_shared_dict dogs 1m;
64+ --- stream_config eval: $::StreamConfig
5865--- stream_server_config
5966 content_by_lua_block {
6067 ngx.shared.dogs:set("doge", "wow")
7885
7986
8087=== TEST 4: Redis inline protocol initialized without shdict, has wrong dict arg.
81- --- stream_config
82- lua_shared_dict dogs 1m;
88+ --- stream_config eval: $::StreamConfig
8389--- stream_server_config
8490 content_by_lua_block {
8591 ngx.shared.dogs:set("doge", "wow")
@@ -101,8 +107,7 @@ quit\r
101107
102108
103109=== TEST 5: Redis inline protocol initialized with password, no password arg.
104- --- stream_config
105- lua_shared_dict dogs 1m;
110+ --- stream_config eval: $::StreamConfig
106111--- stream_server_config
107112 content_by_lua_block {
108113 ngx.shared.dogs:set("doge", "wow")
@@ -126,8 +131,7 @@ quit\r
126131
127132
128133=== TEST 6: Redis inline protocol initialized with password, has password arg.
129- --- stream_config
130- lua_shared_dict dogs 1m;
134+ --- stream_config eval: $::StreamConfig
131135--- stream_server_config
132136 content_by_lua_block {
133137 ngx.shared.dogs:set("doge", "wow")
@@ -153,8 +157,7 @@ quit\r
153157
154158
155159=== TEST 7: Redis inline protocol initialized with password, wrong password arg.
156- --- stream_config
157- lua_shared_dict dogs 1m;
160+ --- stream_config eval: $::StreamConfig
158161--- stream_server_config
159162 content_by_lua_block {
160163 ngx.shared.dogs:set("doge", "wow")
@@ -180,8 +183,7 @@ quit\r
180183
181184
182185=== TEST 8: Redis inline protocol ping
183- --- stream_config
184- lua_shared_dict dogs 1m;
186+ --- stream_config eval: $::StreamConfig
185187--- stream_server_config
186188 content_by_lua_block {
187189 local srv = require("resty.shdict.server")
@@ -202,8 +204,7 @@ quit\r
202204
203205
204206=== TEST 9: Redis inline protocol parse line
205- --- stream_config
206- lua_shared_dict dogs 1m;
207+ --- stream_config eval: $::StreamConfig
207208--- stream_server_config
208209 content_by_lua_block {
209210 ngx.shared.dogs:set("d'o'ge", "wow")
0 commit comments