Skip to content
This repository was archived by the owner on Oct 8, 2025. It is now read-only.

Commit 0716b0c

Browse files
Tests: NJS cacheable variables with access log
Reproduces issue #1169.
1 parent 9993814 commit 0716b0c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/test_njs.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,24 @@ def check_rewrite(rewrite, uri):
116116
check_rewrite('/str', '${vars.uri}')
117117

118118

119+
def test_njs_variables_cacheable_access_log(findall, temp_dir):
120+
assert 'success' in client.conf({"return": 200}, 'routes/0/action')
121+
122+
assert 'success' in client.conf(
123+
{
124+
'path': f'{temp_dir}/access.log',
125+
'format': '`${vars.host}, ${vars.status}\n`',
126+
},
127+
'access_log'
128+
), 'access_log configure'
129+
130+
reqs = 50
131+
for _ in range(reqs):
132+
client.get()
133+
134+
assert len(findall(r'localhost, 200', 'access.log')) == reqs
135+
136+
119137
def test_njs_invalid(skip_alert):
120138
skip_alert(r'js exception:')
121139

0 commit comments

Comments
 (0)