openresty / test-nginx

Data-driven test scaffold for Nginx C module and OpenResty Lua library development
http://search.cpan.org/dist/Test-Nginx
440 stars 106 forks source link

bugfix: ensured we do not remove some files when using HUP mode. #97

Closed thibaultcha closed 4 years ago

thibaultcha commented 4 years ago

Due to eda1139, the html prefix directory is removed in between tests when using the HUP mode. However, in this directory many test suites write a unix socket file, or TLS certificates and keys.

This patch avoids that these files be removed, which would cause failures such as:

t/129-ssl-socket.t .. 121/422
Failed test 'TEST 21: unix domain ssl cosocket (verify) - response_body - response is expected (repeated req 0, req 0)'
at /home/chasum/code/openresty/dev/test-nginx/lib/Test/Nginx/Socket.pm line 1589.
@@ -1,11 +1 @@
-connected: 1
+failed to connect: no such file or directory
-ssl handshake: userdata
-sent http request: 56 bytes.
-received: HTTP/1.1 201 Created
-received: Server: nginx
-received: Content-Type: text/plain
-received: Content-Length: 4
-received: Connection: close
-received:
-received: foo
-close: 1 nil

Failed test 'TEST 21: unix domain ssl cosocket (verify) - grep_error_log_out (req 0)'
at /home/chasum/code/openresty/dev/test-nginx/lib/Test/Nginx/Socket.pm line 1146.
               ''
doesn't match '(?^:^lua ssl save session: ([0-9A-F]+)
lua ssl free session: ([0-9A-F]+)
$)'
agentzh commented 4 years ago

I'm worried that the html/ files created by earlier test cases may leave unwanted side effects to subsequent test cases. Maybe it's better to create a separate directory, say, sockets/ for unix domain socket files exclusively?