HaoTien commented on code in PR #12765:
URL: https://github.com/apache/apisix/pull/12765#discussion_r2671497825


##########
t/plugin/api-breaker.t:
##########
@@ -605,7 +641,7 @@ passed
                 ngx.sleep(1)
             end
 
-            ngx.say(json.encode(status_count))
+            ngx.say(string.format('{"500":%d,"502":%d}', status_count["500"], 
status_count["502"]))

Review Comment:
   Two test case files have been passed
   
   $ docker exec -it apisix-dev-env prove --timer -I./test-nginx/lib -I./ 
t/plugin/api-breaker.t
   [16:16:40] t/plugin/api-breaker.t .. 1/? t/plugin/api-breaker.t TEST 2: 
default configuration - timeout when waiting for the process 322 to exit at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker.t TEST 2: default configuration - WARNING: killing the 
child process 322 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:16:40] t/plugin/api-breaker.t .. 4/? t/plugin/api-breaker.t TEST 3: 
default `healthy` - timeout when waiting for the process 329 to exit at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker.t TEST 3: default `healthy` - WARNING: killing the 
child process 329 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:16:40] t/plugin/api-breaker.t .. 7/? t/plugin/api-breaker.t TEST 4: 
default `unhealthy` - timeout when waiting for the process 336 to exit at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker.t TEST 4: default `unhealthy` - WARNING: killing the 
child process 336 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:16:40] t/plugin/api-breaker.t .. 10/? t/plugin/api-breaker.t TEST 5: bad 
break_response_code - timeout when waiting for the process 343 to exit at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker.t TEST 5: bad break_response_code - WARNING: killing 
the child process 343 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:16:40] t/plugin/api-breaker.t .. 13/? t/plugin/api-breaker.t TEST 6: bad 
max_breaker_sec - timeout when waiting for the process 350 to exit at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker.t TEST 6: bad max_breaker_sec - WARNING: killing the 
child process 350 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:16:40] t/plugin/api-breaker.t .. 16/? t/plugin/api-breaker.t TEST 7: bad 
unhealthy.http_statuses - timeout when waiting for the process 357 to exit at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker.t TEST 7: bad unhealthy.http_statuses - WARNING: 
killing the child process 357 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:16:40] t/plugin/api-breaker.t .. 18/? t/plugin/api-breaker.t TEST 8: 
same http_statuses in healthy - timeout when waiting for the process 364 to 
exit at /usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker.t TEST 8: same http_statuses in healthy - WARNING: 
killing the child process 364 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:16:40] t/plugin/api-breaker.t .. 20/? t/plugin/api-breaker.t TEST 9: set 
route, http_statuses: [500, 503] - timeout when waiting for the process 371 to 
exit at /usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker.t TEST 9: set route, http_statuses: [500, 503] - 
WARNING: killing the child process 371 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:16:40] t/plugin/api-breaker.t .. 23/? t/plugin/api-breaker.t TEST 10: 
trigger breaker - timeout when waiting for the process 378 to exit at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker.t TEST 10: trigger breaker - WARNING: killing the child 
process 378 with force... at /usr/local/share/perl/5.30.0/Test/Nginx/Util.pm 
line 707.
   [16:16:40] t/plugin/api-breaker.t .. 37/? t/plugin/api-breaker.t TEST 11: 
trigger reset status - timeout when waiting for the process 385 to exit at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker.t TEST 11: trigger reset status - WARNING: killing the 
child process 385 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:16:40] t/plugin/api-breaker.t .. 48/? t/plugin/api-breaker.t TEST 12: 
trigger del healthy numeration - timeout when waiting for the process 392 to 
exit at /usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker.t TEST 12: trigger del healthy numeration - WARNING: 
killing the child process 392 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:16:40] t/plugin/api-breaker.t .. 52/? t/plugin/api-breaker.t TEST 13: 
add plugin with default config value - timeout when waiting for the process 399 
to exit at /usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker.t TEST 13: add plugin with default config value - 
WARNING: killing the child process 399 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:16:40] t/plugin/api-breaker.t .. 57/? t/plugin/api-breaker.t TEST 14: 
default value - timeout when waiting for the process 406 to exit at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker.t TEST 14: default value - WARNING: killing the child 
process 406 with force... at /usr/local/share/perl/5.30.0/Test/Nginx/Util.pm 
line 707.
   [16:16:40] t/plugin/api-breaker.t .. 60/? t/plugin/api-breaker.t TEST 15: 
trigger default value of unhealthy.http_statuses breaker - timeout when waiting 
for the process 413 to exit at /usr/local/share/perl/5.30.0/Test/Nginx/Util.pm 
line 668.
   t/plugin/api-breaker.t TEST 15: trigger default value of 
unhealthy.http_statuses breaker - WARNING: killing the child process 413 with 
force... at /usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:16:40] t/plugin/api-breaker.t .. 70/? t/plugin/api-breaker.t TEST 16: 
unhealthy -> timeout -> normal - timeout when waiting for the process 420 to 
exit at /usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker.t TEST 16: unhealthy -> timeout -> normal - WARNING: 
killing the child process 420 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:16:40] t/plugin/api-breaker.t .. 106/? t/plugin/api-breaker.t TEST 17: 
unhealthy -> timeout -> unhealthy - timeout when waiting for the process 427 to 
exit at /usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker.t TEST 17: unhealthy -> timeout -> unhealthy - WARNING: 
killing the child process 427 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:16:40] t/plugin/api-breaker.t .. 130/? t/plugin/api-breaker.t TEST 18: 
enable plugin, unhealthy.failures=1 - timeout when waiting for the process 434 
to exit at /usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker.t TEST 18: enable plugin, unhealthy.failures=1 - 
WARNING: killing the child process 434 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:16:40] t/plugin/api-breaker.t .. 132/? t/plugin/api-breaker.t TEST 19: 
hit route 20 times, confirm the breaker time - timeout when waiting for the 
process 441 to exit at /usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker.t TEST 19: hit route 20 times, confirm the breaker time 
- WARNING: killing the child process 441 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:16:40] t/plugin/api-breaker.t .. 135/? t/plugin/api-breaker.t TEST 20: 
reject invalid schema - timeout when waiting for the process 448 to exit at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker.t TEST 20: reject invalid schema - WARNING: killing the 
child process 448 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:16:40] t/plugin/api-breaker.t .. 143/? END - timeout when waiting for 
the process 455 to exit at /usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 
668.
   END - WARNING: killing the child process 455 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:16:40] t/plugin/api-breaker.t .. ok   198007 ms ( 0.03 usr  0.01 sys +  
1.19 cusr  0.78 csys =  2.01 CPU)
   [16:19:58]
   All tests successful.
   Files=1, Tests=145, 198 wallclock secs ( 0.04 usr  0.01 sys +  1.19 cusr  
0.78 csys =  2.02 CPU)
   Result: PASS
   
   $ docker exec -it apisix-dev-env prove --timer -I./test-nginx/lib -I./ 
t/plugin/api-breaker2.t
   [16:27:52] t/plugin/api-breaker2.t .. 1/? t/plugin/api-breaker2.t TEST 2: 
default configuration for unhealthy-ratio policy - timeout when waiting for the 
process 473 to exit at /usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker2.t TEST 2: default configuration for unhealthy-ratio 
policy - WARNING: killing the child process 473 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:27:52] t/plugin/api-breaker2.t .. 4/? t/plugin/api-breaker2.t TEST 3: 
bad error_ratio (too high) - timeout when waiting for the process 480 to exit 
at /usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker2.t TEST 3: bad error_ratio (too high) - WARNING: 
killing the child process 480 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:27:52] t/plugin/api-breaker2.t .. 7/? t/plugin/api-breaker2.t TEST 4: 
bad error_ratio (negative) - timeout when waiting for the process 487 to exit 
at /usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker2.t TEST 4: bad error_ratio (negative) - WARNING: 
killing the child process 487 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:27:52] t/plugin/api-breaker2.t .. 10/? t/plugin/api-breaker2.t TEST 5: 
bad min_request_threshold (zero) - timeout when waiting for the process 494 to 
exit at /usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker2.t TEST 5: bad min_request_threshold (zero) - WARNING: 
killing the child process 494 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:27:52] t/plugin/api-breaker2.t .. 13/? t/plugin/api-breaker2.t TEST 6: 
bad sliding_window_size (too small) - timeout when waiting for the process 501 
to exit at /usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker2.t TEST 6: bad sliding_window_size (too small) - 
WARNING: killing the child process 501 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:27:52] t/plugin/api-breaker2.t .. 16/? t/plugin/api-breaker2.t TEST 7: 
bad sliding_window_size (too large) - timeout when waiting for the process 508 
to exit at /usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker2.t TEST 7: bad sliding_window_size (too large) - 
WARNING: killing the child process 508 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:27:52] t/plugin/api-breaker2.t .. 19/? t/plugin/api-breaker2.t TEST 8: 
bad success_ratio (too high) - timeout when waiting for the process 515 to exit 
at /usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker2.t TEST 8: bad success_ratio (too high) - WARNING: 
killing the child process 515 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:27:52] t/plugin/api-breaker2.t .. 22/? t/plugin/api-breaker2.t TEST 9: 
bad half_open_max_calls (too large) - timeout when waiting for the process 522 
to exit at /usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker2.t TEST 9: bad half_open_max_calls (too large) - 
WARNING: killing the child process 522 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:27:52] t/plugin/api-breaker2.t .. 25/? t/plugin/api-breaker2.t TEST 10: 
set route with unhealthy-ratio policy - timeout when waiting for the process 
529 to exit at /usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker2.t TEST 10: set route with unhealthy-ratio policy - 
WARNING: killing the child process 529 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:27:52] t/plugin/api-breaker2.t .. 28/? t/plugin/api-breaker2.t TEST 
$((${1}+1)): test ratio-based circuit breaker functionality - timeout when 
waiting for the process 536 to exit at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker2.t TEST $((${1}+1)): test ratio-based circuit breaker 
functionality - WARNING: killing the child process 536 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:27:52] t/plugin/api-breaker2.t .. 42/? t/plugin/api-breaker2.t TEST 
$((${1}+1)): wait for circuit breaker to enter half-open state - timeout when 
waiting for the process 543 to exit at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker2.t TEST $((${1}+1)): wait for circuit breaker to enter 
half-open state - WARNING: killing the child process 543 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:27:52] t/plugin/api-breaker2.t .. 46/? t/plugin/api-breaker2.t TEST 11: 
test half-open state functionality - timeout when waiting for the process 550 
to exit at /usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker2.t TEST 11: test half-open state functionality - 
WARNING: killing the child process 550 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:27:52] t/plugin/api-breaker2.t .. 49/? t/plugin/api-breaker2.t TEST 12: 
verify circuit breaker works with custom break_response_headers - timeout when 
waiting for the process 557 to exit at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker2.t TEST 12: verify circuit breaker works with custom 
break_response_headers - WARNING: killing the child process 557 with force... 
at /usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:27:52] t/plugin/api-breaker2.t .. 58/? t/plugin/api-breaker2.t TEST 13: 
trigger circuit breaker with custom headers (combined) - timeout when waiting 
for the process 564 to exit at /usr/local/share/perl/5.30.0/Test/Nginx/Util.pm 
line 668.
   t/plugin/api-breaker2.t TEST 13: trigger circuit breaker with custom headers 
(combined) - WARNING: killing the child process 564 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:27:52] t/plugin/api-breaker2.t .. 63/? t/plugin/api-breaker2.t TEST 14: 
setup route for sliding window expiration test - timeout when waiting for the 
process 571 to exit at /usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker2.t TEST 14: setup route for sliding window expiration 
test - WARNING: killing the child process 571 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:27:52] t/plugin/api-breaker2.t .. 67/? t/plugin/api-breaker2.t TEST 15: 
test sliding window statistics reset after expiration - timeout when waiting 
for the process 578 to exit at /usr/local/share/perl/5.30.0/Test/Nginx/Util.pm 
line 668.
   t/plugin/api-breaker2.t TEST 15: test sliding window statistics reset after 
expiration - WARNING: killing the child process 578 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:27:52] t/plugin/api-breaker2.t .. 70/? t/plugin/api-breaker2.t TEST 16: 
setup route for half-open failure fallback test - timeout when waiting for the 
process 585 to exit at /usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker2.t TEST 16: setup route for half-open failure fallback 
test - WARNING: killing the child process 585 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:27:52] t/plugin/api-breaker2.t .. 73/? t/plugin/api-breaker2.t TEST 17: 
test half-open state failure fallback to open state - timeout when waiting for 
the process 592 to exit at /usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 
668.
   t/plugin/api-breaker2.t TEST 17: test half-open state failure fallback to 
open state - WARNING: killing the child process 592 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:27:52] t/plugin/api-breaker2.t .. 76/? t/plugin/api-breaker2.t TEST 18: 
setup route for half-open request limit test - timeout when waiting for the 
process 599 to exit at /usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker2.t TEST 18: setup route for half-open request limit 
test - WARNING: killing the child process 599 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:27:52] t/plugin/api-breaker2.t .. 79/? t/plugin/api-breaker2.t TEST 19: 
test half-open state request limit enforcement and header check - timeout when 
waiting for the process 606 to exit at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 668.
   t/plugin/api-breaker2.t TEST 19: test half-open state request limit 
enforcement and header check - WARNING: killing the child process 606 with 
force... at /usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:27:52] t/plugin/api-breaker2.t .. 82/? END - timeout when waiting for 
the process 613 to exit at /usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 
668.
   END - WARNING: killing the child process 613 with force... at 
/usr/local/share/perl/5.30.0/Test/Nginx/Util.pm line 707.
   [16:27:52] t/plugin/api-breaker2.t .. ok   201302 ms ( 0.01 usr  0.01 sys +  
1.17 cusr  0.79 csys =  1.98 CPU)
   [16:31:13]
   All tests successful.
   Files=1, Tests=84, 201 wallclock secs ( 0.02 usr  0.01 sys +  1.17 cusr  
0.79 csys =  1.99 CPU)
   Result: PASS



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to