File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -458,6 +458,12 @@ function _M.new(opts)
458458end
459459
460460
461+ function _grpc_M .close (self )
462+ self .conn :close ()
463+ self .conn = nil
464+ end
465+
466+
461467local function wake_up_everyone (self )
462468 local count = - self .sema :count ()
463469 if count > 0 then
Original file line number Diff line number Diff line change @@ -25,6 +25,13 @@ add_block_preprocessor(sub {
2525 if ((!defined $block -> error_log) && (!defined $block -> no_error_log)) {
2626 $block -> set_value(" no_error_log" , " [error]" );
2727 }
28+
29+ my $http_config = <<'_EOC_' ;
30+ lua_package_path 'lib/?.lua;/usr/local/share/lua/5.3/?.lua;/usr/share/lua/5.1/?.lua;;';
31+ _EOC_
32+ if (!$block -> http_config) {
33+ $block -> set_value(" http_config" , $http_config );
34+ }
2835});
2936
3037run_tests();
@@ -47,3 +54,16 @@ init_by_lua_block {
4754 }
4855 }
4956--- response_body
57+
58+
59+
60+ === TEST 2: close conn
61+ --- config
62+ location /t {
63+ content_by_lua_block {
64+ local etcd = require "resty.etcd" .new({protocol = "v3", use_grpc = true})
65+ assert(etcd.conn ~= nil)
66+ etcd:close()
67+ assert(etcd.conn == nil)
68+ }
69+ }
You can’t perform that action at this time.
0 commit comments