source: mod_gnutls/test/tests/37_TLS_reverse_proxy_resume_session/hooks.py @ a4e3b2c

asyncio
Last change on this file since a4e3b2c was a4e3b2c, checked in by Fiona Klute <fiona.klute@…>, 17 months ago

Simple test for proxy session resumption

  • Property mode set to 100644
File size: 1.0 KB
Line 
1import re
2from mgstest import require_match
3from pathlib import Path
4
5
6LOGFILE = Path('logs/37_TLS_reverse_proxy_resume_session.backend.error.log')
7LOGFILE_POSITION = 0
8
9
10def prepare_env():
11    # Seek to the end of server log, if it exists from previous tests
12    if LOGFILE.exists():
13        global LOGFILE_POSITION
14        LOGFILE_POSITION = LOGFILE.stat().st_size
15
16
17def post_check(conn_log, response_log):
18    conn_opened = re.compile(r'TLS connection opened.')
19    conn_closed = re.compile(r'TLS connection closed.')
20    session_resumed = re.compile(r'TLS session resumed.')
21
22    print('Checking if the backend server log contains session resumption')
23    with LOGFILE.open() as log:
24        print(f'Seeking to position {LOGFILE_POSITION}')
25        log.seek(LOGFILE_POSITION)
26
27        require_match(conn_opened, log)
28        require_match(conn_closed, log)
29        print('Initial session found.')
30
31        require_match(session_resumed, log)
32        require_match(conn_opened, log)
33        require_match(conn_closed, log)
34        print('Resumed session found.')
Note: See TracBrowser for help on using the repository browser.