Tests: NJS cacheable variables with access log

Reproduces issue https://github.com/nginx/unit/issues/1169.
This commit is contained in:
Andrei Zeliankou 2024-03-11 13:45:39 +00:00 committed by andrey-zelenkov
parent 9993814d14
commit 0716b0c752

View file

@ -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:')