Skip to content

Commit 8d0ca58

Browse files
committed
tests: fixed a shdict list test case that failed on i386.
1 parent 8f16084 commit 8d0ca58

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

t/145-shdict-list.t

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -503,8 +503,10 @@ GET /test
503503
content_by_lua_block {
504504
local dogs = ngx.shared.dogs
505505
506-
local max
507-
for i = 1, 10000 do
506+
local N = 100000
507+
local max = 0
508+
509+
for i = 1, N do
508510
local key = string.format("%05d", i)
509511
510512
local len , err = dogs:lpush(key, i)
@@ -516,20 +518,20 @@ GET /test
516518
517519
local keys = dogs:get_keys(0)
518520
519-
ngx.say("max-1 matched keys length: ", max-1 == #keys)
521+
ngx.say("max - 1 matched keys length: ", max - 1 == #keys)
520522
521523
dogs:flush_all()
522524
523525
local keys = dogs:get_keys(0)
524526
525527
ngx.say("keys all expired, left number: ", #keys)
526528
527-
for i = 10000, 1, -1 do
529+
for i = 100000, 1, -1 do
528530
local key = string.format("%05d", i)
529531
530532
local len, err = dogs:lpush(key, i)
531533
if not len then
532-
ngx.say("loop again, max matched: ", 10001-i == max)
534+
ngx.say("loop again, max matched: ", N + 1 - i == max)
533535
break
534536
end
535537
end
@@ -538,7 +540,7 @@ GET /test
538540
539541
dogs:flush_expired()
540542
541-
for i = 1, 10000 do
543+
for i = 1, N do
542544
local key = string.format("%05d", i)
543545
544546
local len, err = dogs:lpush(key, i)
@@ -552,7 +554,7 @@ GET /test
552554
--- request
553555
GET /test
554556
--- response_body
555-
max-1 matched keys length: true
557+
max - 1 matched keys length: true
556558
keys all expired, left number: 0
557559
loop again, max matched: true
558560
loop again, max matched: true

0 commit comments

Comments
 (0)