diff options
author | Andrei Zeliankou <zelenkov@nginx.com> | 2022-10-13 10:13:57 +0100 |
---|---|---|
committer | Andrei Zeliankou <zelenkov@nginx.com> | 2022-10-13 10:13:57 +0100 |
commit | af5903ff4ee83a0c632a07828ed80a0b5f40aefd (patch) | |
tree | 2647926d6383314f9f8f66e5b35288adfc0f166c /test | |
parent | 7aa6b0629897235684961dfb9aa16e226efa27e6 (diff) | |
download | unit-af5903ff4ee83a0c632a07828ed80a0b5f40aefd.tar.gz unit-af5903ff4ee83a0c632a07828ed80a0b5f40aefd.tar.bz2 |
Tests: added tests for the $request_time variable.
Diffstat (limited to 'test')
-rw-r--r-- | test/test_variables.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/test_variables.py b/test/test_variables.py index 43c5c471..ebbc5aa2 100644 --- a/test/test_variables.py +++ b/test/test_variables.py @@ -47,6 +47,35 @@ class TestVariables(TestApplicationProto): ) check_dollar('path$dollar${dollar}', 'path$$') + def test_variables_request_time(self): + self.set_format('$uri $request_time') + + sock = self.http(b'', raw=True, no_recv=True) + + time.sleep(1) + + assert self.get(url='/r_time_1', sock=sock)['status'] == 200 + assert self.wait_for_record(r'\/r_time_1 0\.\d{3}') is not None + + sock = self.http( + b"""G""", + no_recv=True, + raw=True, + ) + + time.sleep(2) + + self.http( + b"""ET /r_time_2 HTTP/1.1 +Host: localhost +Connection: close + +""", + sock=sock, + raw=True, + ) + assert self.wait_for_record(r'\/r_time_2 [1-9]\.\d{3}') is not None + def test_variables_method(self): self.set_format('$method') |