bzp2010 commented on PR #10732: URL: https://github.com/apache/apisix/pull/10732#issuecomment-1880463567
In fact, I've implemented the third point mentioned (create a `tmp` dir alongside `conf` and `logs`) and it still doesn't work. The test::nginx makes some pretty dirty assumptions, it completely disregards any directories (conf, logs, html, etc) that may exist under the servroot other than the ones it confirms exist, and therefore its cleanup doesn't work properly. [https://github.com/openresty/test-nginx/blob/40aa6364b0a428779cbf96cd10f49b20166483ee/lib/Test/Nginx/Util.pm#L867-L891](https://github.com/openresty/test-nginx/blob/40aa6364b0a428779cbf96cd10f49b20166483ee/lib/Test/Nginx/Util.pm#L867-L891) And the test::nginx will only do special things to paths like `*_cache` and `*_temp` to remove them. [https://github.com/openresty/test-nginx/blob/40aa6364b0a428779cbf96cd10f49b20166483ee/lib/Test/Nginx/Util.pm#L870-L871](https://github.com/openresty/test-nginx/blob/40aa6364b0a428779cbf96cd10f49b20166483ee/lib/Test/Nginx/Util.pm#L870-L871) Instead it tries again to rebuild the servroot folder before the start of each test case, and there are no hooks available there for early cleanup files. I have tested the cleanup added via `add_cleanup_handler` and it will run after an error occurs, so it won't work. Therefore the use of special cases in testing is indispensable (in my perception). For example, use an environment variable to overwrite the directory used for testing. Is there a better way to do this? ping @shreemaan-abhishek @monkeyDluffy6017 🤔 -- 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]
