Skip to content

Commit a857281

Browse files
committed
tests: enforced a full GC cycle in more memory-intensive test cases that may confuse leak testing due to GC latencies.
1 parent 779dd38 commit a857281

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

t/sanity.t

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ foo
7272
location /t {
7373
content_by_lua 'ngx.say("foo")';
7474
log_by_lua '
75+
collectgarbage() -- to help leak testing
76+
7577
local logger = require "resty.logger.socket"
7678
if not logger.initted() then
7779
local ok, err = logger.init{
@@ -112,6 +114,8 @@ foo
112114
location /t {
113115
content_by_lua 'ngx.say("foo")';
114116
log_by_lua '
117+
collectgarbage() -- to help leak testing
118+
115119
local logger = require "resty.logger.socket"
116120
if not logger.initted() then
117121
local ok, err = logger.init{
@@ -210,6 +214,8 @@ foo
210214
log_subrequest on;
211215
location /t {
212216
content_by_lua '
217+
collectgarbage() -- to help leak testing
218+
213219
local res = ngx.location.capture("/main?c=1&d=2")
214220
if res.status ~= 200 then
215221
ngx.log(ngx.ERR, "capture /main failed")
@@ -262,6 +268,8 @@ foo
262268
log_subrequest on;
263269
location /t {
264270
content_by_lua '
271+
collectgarbage() -- to help leak testing
272+
265273
local res = ngx.location.capture("/main?c=1&d=2")
266274
if res.status ~= 200 then
267275
ngx.log(ngx.ERR, "capture /main failed")
@@ -512,6 +520,8 @@ foo
512520
--- config
513521
location /t {
514522
content_by_lua '
523+
collectgarbage() -- to help leak testing
524+
515525
ngx.say("foo")
516526
local logger = require "resty.logger.socket"
517527
if not logger.initted() then

0 commit comments

Comments
 (0)