Skip to content

Commit

Permalink
Tests: NJS cacheable variables with access log
Browse files Browse the repository at this point in the history
Reproduces issue #1169.
  • Loading branch information
andrey-zelenkov committed Mar 12, 2024
1 parent 9993814 commit 0716b0c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/test_njs.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,24 @@ def check_rewrite(rewrite, uri):
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:')

Expand Down

0 comments on commit 0716b0c

Please sign in to comment.