tzssangglass commented on code in PR #8366:
URL: https://github.com/apache/apisix/pull/8366#discussion_r1029035295


##########
t/plugin/log-rotate2.t:
##########
@@ -173,3 +176,35 @@ plugin_attr:
     }
 --- response_body
 passed
+
+
+
+=== TEST 5: max_kept effective on compression files
+--- extra_yaml_config
+plugins:
+  - log-rotate
+plugin_attr:
+  log-rotate:
+    interval: 1
+    max_kept: 1
+    enable_compression: true
+--- config
+    location /t {
+        content_by_lua_block {
+            ngx.sleep(3.5)
+            local has_split_access_file = false
+            local has_split_error_file = false
+            local lfs = require("lfs")
+            local count = 0
+            for file_name in lfs.dir(ngx.config.prefix() .. "/logs/") do
+                if string.match(file_name, ".tar.gz$") then
+                    count = count + 1
+                end
+            end
+            --- only two compression file, access.log.tar.gz and 
error.log.tar.gz

Review Comment:
   > The compression file should be named with a timestamp?
   
   The names of the compressed files actually contain timestamps, like 
`2022-11-22_16-50-37__access.log.tar.gz`, 
`2022-11-22_16-50-38__error.log.tar.gz`,  the comment is just to indicate that 
only two (timestamped) compressed files remain in this test condition.



-- 
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