summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrei Zeliankou <zelenkov@nginx.com>2024-03-11 13:45:39 +0000
committerAndrei Zeliankou <zelenkov@nginx.com>2024-03-15 15:12:38 +0000
commitd7ff6bb4a10e3999f788a2492944c70822441366 (patch)
tree3f0ff63ca028b17cd4770657fbe49349fa998b15
parent6359c74da1f53dc533ee26acc28972ed9816c9a6 (diff)
downloadunit-d7ff6bb4a10e3999f788a2492944c70822441366.tar.gz
unit-d7ff6bb4a10e3999f788a2492944c70822441366.tar.bz2
Tests: NJS cacheable variables with access log
Reproduces issue https://github.com/nginx/unit/issues/1169.
-rw-r--r--test/test_njs.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/test_njs.py b/test/test_njs.py
index 8ef815fd..23d1df1b 100644
--- a/test/test_njs.py
+++ b/test/test_njs.py
@@ -116,6 +116,24 @@ def test_njs_variables_cacheable(temp_dir):
check_rewrite('/str', '${vars.uri}')
+def test_njs_variables_cacheable_access_log(findall, temp_dir):
+ assert 'success' in client.conf({"return": 200}, 'routes/0/action')
+
+ assert 'success' in client.conf(
+ {
+ 'path': f'{temp_dir}/access.log',
+ 'format': '`${vars.host}, ${vars.status}\n`',
+ },
+ 'access_log'
+ ), 'access_log configure'
+
+ reqs = 50
+ for _ in range(reqs):
+ client.get()
+
+ assert len(findall(r'localhost, 200', 'access.log')) == reqs
+
+
def test_njs_invalid(skip_alert):
skip_alert(r'js exception:')