On Mon, Jan 10, 2022 at 01:28:52PM +0000, Hugo Lefeuvre wrote:
On Sun, Jul 04, 2021 at 04:29:43AM +0300, Maxim Dounin wrote:
On Sat, Jul 03, 2021 at 09:18:53AM +0100, Hugo Lefeuvre wrote:
I am trying to run the test suite, but it seems that, no matter how I build Nginx, it systematically fails.
It seems that, most (all?) of the time, tests fail because Nginx returns 403 error codes, e.g.:
./ssi_waited.t ............................. 1/3 # Failed test 'waited non-active' # at ./ssi_waited.t line 60. # 'HTTP/1.1 403 Forbidden # Server: nginx/1.21.0 # Date: Sat, 03 Jul 2021 08:06:00 GMT # Content-Type: text/html # Connection: close # # <html> # <head><title>403 Forbidden</title></head> # <body> # <center><h1>403 Forbidden</h1></center> # <hr><center>nginx/1.21.0</center> # </body> # </html> # ' # doesn't match '(?^m:^xFIRSTxWAITEDxSECONDx$)'
The runtime configuration is the default one from nginx-1.20.1.tar.gz (conf/nginx.conf).
I must be doing something wrong with the build or run time configuration, but I cannot pinpoint what. Any idea?
Test output suggests that you are testing nginx 1.21.0, not 1.20.1. It looks like you are testing the wrong nginx binary, not the one you think you are testing. This might be the reason, for example, if you have some 3rd party modules compiled in and these modules reject requests for some reason.
For additional details try looking into test details - in particular, test suite can leave full test configuration and logs for you with TEST_NGINX_LEAVE environment variable set, or simply cat the error log to the terminal before removing files with TEST_NGINX_CATLOG. See README of the test suite for details.
Sorry for the late answer, but better late than never!
The reason was that I was running the test suite as root. Switching to a non-root user did the trick. I was indeed trying to run 1.21.1, not 1.20.1, that was a typo in the title.
I think that the test suite README should mention that it cannot be run as root.
Ah, that's certainly explains the failure.
The test suite can be run as root, but, given that nginx switches to a non-privileged user by default (https://nginx.org/r/user), and temporary directory is only readable by the owner, running test suite as root requires some additional tuning for most of the tests to work, e.g.:
# TEST_NGINX_GLOBALS="user root wheel;" prove ssi_waited.t
The fact that the test suite by default is expected to be run under a normal user is already in the README, though may be in somewhat obscure form: note the "$ " prompt in the usage example.