diff options
author | Konstantin Pavlov <thresh@nginx.com> | 2024-12-19 10:23:57 -0800 |
---|---|---|
committer | Konstantin Pavlov <thresh@nginx.com> | 2024-12-19 10:23:57 -0800 |
commit | d8acad350a52a20918c46c09cb0a0f5479400923 (patch) | |
tree | 7d9c4b64daa60d3ac121743dfa3735c6fc5687a4 /test/test_access_log.py | |
parent | 624debcf17ea7faab01fa841bd4dcd9f308cf306 (diff) | |
parent | 27bde184dedcbf687db2f314c60c037623318a8d (diff) | |
download | unit-d8acad350a52a20918c46c09cb0a0f5479400923.tar.gz unit-d8acad350a52a20918c46c09cb0a0f5479400923.tar.bz2 |
Merge tag '1.34.0' into packaging1.34.0-1
Unit 1.34.0 release.
Diffstat (limited to 'test/test_access_log.py')
-rw-r--r-- | test/test_access_log.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/test_access_log.py b/test/test_access_log.py index 1b0ec8ad..47099bd0 100644 --- a/test/test_access_log.py +++ b/test/test_access_log.py @@ -298,6 +298,12 @@ def test_access_log_format(wait_for_record): check_format(log_format, log_format) check_format('$uri $status $uri $status', '/ 200 / 200') + log_format = { + 'status': '$status', + 'uri': '$uri' + } + check_format(log_format, '{"status":"200","uri":"/"}') + def test_access_log_variables(wait_for_record): load('mirror') @@ -368,6 +374,24 @@ def test_access_log_if_njs(require, search_in_file, wait_for_record): assert search_in_file(r'^/foo_2$', 'access.log') is None +def test_access_log_format_njs(require, search_in_file, wait_for_record): + require({'modules': {'njs': 'any'}}) + + load('empty') + + def check_format(log_format, expect, url='/'): + set_format(log_format) + + assert client.get(url=url)['status'] == 200 + assert wait_for_record(expect, 'access.log') is not None, 'found' + + log_format = { + 'status': '$status', + 'uri': '`${vars.uri}`' + } + check_format(log_format, '{"status":"200","uri":"/"}') + + def test_access_log_incorrect(temp_dir, skip_alert): skip_alert(r'failed to apply new conf') |