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)
458
458
end
459
459
460
460
461
+ function _grpc_M .close (self )
462
+ self .conn :close ()
463
+ self .conn = nil
464
+ end
465
+
466
+
461
467
local function wake_up_everyone (self )
462
468
local count = - self .sema :count ()
463
469
if count > 0 then
Original file line number Diff line number Diff line change @@ -25,6 +25,13 @@ add_block_preprocessor(sub {
25
25
if ((!defined $block -> error_log) && (!defined $block -> no_error_log)) {
26
26
$block -> set_value(" no_error_log" , " [error]" );
27
27
}
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
+ }
28
35
});
29
36
30
37
run_tests();
@@ -47,3 +54,16 @@ init_by_lua_block {
47
54
}
48
55
}
49
56
--- 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