Skip to content

Commit 4d002e2

Browse files
tdufBastian-Krause
authored andcommitted
test: fix nginx temp path for non-root user
Under some unknown circumstances, the current nginx config run as non-root still leads to fatal errors: $ ./test/wait-for-hawkbit-online && dbus-run-session -- pytest -v -o log_cli=true test/test_download.py [...] test/test_download.py::test_download_too_slow -------------------------------------------------------- live log call -------------------------------------------------------- INFO nginx running: nginx -c /tmp/pytest-of-thibaud/pytest-8/nginx0/nginx.conf -p . INFO nginx nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied) INFO nginx 2024/06/28 15:41:56 [emerg] 1450257#1450257: mkdir() "/var/lib/nginx/tmp/client_body" failed (13: Permission denied) SKIPPED (nginx failed, use -s to see logs) [ 42%] test/test_download.py::test_download_partials_without_resume ------------------------------------------------------- live log setup -------------------------------------------------------- INFO nginx running: nginx -c /tmp/pytest-of-thibaud/pytest-8/nginx1/nginx.conf -p . INFO nginx nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied) INFO nginx 2024/06/28 15:41:56 [emerg] 1450258#1450258: mkdir() "/var/lib/nginx/tmp/client_body" failed (13: Permission denied) SKIPPED (nginx failed, use -s to see logs) [ 57%] test/test_download.py::test_download_partials_with_resume SKIPPED (nginx failed, use -s to see logs) [ 71%] test/test_download.py::test_download_slow_with_resume -------------------------------------------------------- live log call -------------------------------------------------------- INFO nginx running: nginx -c /tmp/pytest-of-thibaud/pytest-8/nginx2/nginx.conf -p . INFO nginx nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied) INFO nginx 2024/06/28 15:41:56 [emerg] 1450259#1450259: mkdir() "/var/lib/nginx/tmp/client_body" failed (13: Permission denied) SKIPPED (nginx failed, use -s to see logs) The section "Running nginx as a non-root user" of the official nginx docker image [1] gives a hint what options must be set to not run into errors. Apply the config directives appropriate for our use case. [1] https://hub.docker.com/_/nginx Signed-off-by: Thibaud Dufour <[email protected]> [bst: dropped unused options fastcgi_temp_path, uwsgi_temp_path, scgi_temp_path, rebased] Signed-off-by: Bastian Krause <[email protected]>
1 parent 33e87fd commit 4d002e2

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

test/conftest.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
# SPDX-License-Identifier: LGPL-2.1-only
23
# SPDX-FileCopyrightText: 2021 Enrico Jörns <[email protected]>, Pengutronix
34
# SPDX-FileCopyrightText: 2021-2022 Bastian Krause <[email protected]>, Pengutronix
@@ -259,6 +260,7 @@ def _nginx_config(port, location_options, *, mtls=False):
259260
location_options=_to_nginx_option(location_options),
260261
server_options=_to_nginx_option(server_options),
261262
module_path=os.environ.get('NGINX_MODULES', '/usr/lib/nginx/modules'),
263+
nginx_temp=nginx_temp,
262264
)
263265
proxy_config.write_text(proxy_config_str)
264266

test/nginx/base.conf.in

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ events { }
1212

1313
http {
1414
access_log /dev/null;
15+
client_body_temp_path /${nginx_temp}/client_temp;
16+
proxy_temp_path /${nginx_temp}/proxy_temp_path;
1517

1618
map $$ssl_client_s_dn $$ssl_client_s_dn_cn {
1719
default "";

0 commit comments

Comments
 (0)