Changeset 0f52d48 in mod_gnutls


Ignore:
Timestamp:
Jan 8, 2020, 5:06:31 PM (3 years ago)
Author:
Fiona Klute <fiona.klute@…>
Branches:
asyncio, main, master, proxy-ticket
Children:
482bafc
Parents:
baa0056
Message:

Switch most tests to hooks.py instead of preconditions in test scripts

The new function mgstest.require_apache_modules() covers required
Apache modules, the rest is individual stuff.

Location:
test
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • test/mgstest/__init__.py

    rbaa0056 r0f52d48  
    1818
    1919import fcntl
     20import os
     21import os.path
    2022import sys
    2123
    2224from contextlib import contextmanager
     25from unittest import SkipTest
    2326
    2427class TestExpectationFailed(Exception):
     
    8891    else:
    8992        raise TestExpectationFailed(f'No match found for {regexp.pattern}!')
     93
     94
     95
     96def require_apache_modules(*modules):
     97    """Raise unittest.SkipTest if any of the given module files (full file
     98    name) is not present in AP_LIBEXECDIR.
     99
     100    """
     101    mod_dir = os.environ['AP_LIBEXECDIR']
     102    for mod in modules:
     103        if not os.path.isfile(os.path.join(mod_dir, mod)):
     104            raise SkipTest(f'{mod} not found, skipping.')
  • test/test-27_OCSP_server.bash

    rbaa0056 r0f52d48  
    11#!/bin/bash
    2 
    3 # Skip if OCSP tests are not enabled
    4 [ -n "${OCSP_PORT}" ] || exit 77
    5 
    62. ${srcdir}/netns_py.bash ${srcdir}/runtest.py --test-number 27
  • test/test-28_HTTP2_support.bash

    rbaa0056 r0f52d48  
    11#!/bin/bash
    2 #
    3 # Check if HTTP/2 connections using mod_gnutls and mod_http2 work
    4 
    5 set -e
    6 
    7 if [ ! -r ${AP_LIBEXECDIR}/mod_http2.so ]; then
    8     echo "mod_http2.so not found, skipping." 2>&1
    9     exit 77
    10 elif [ "$(basename ${HTTP_CLI})" != "curl" ] \
    11        || ! ${HTTP_CLI} -V | grep -P '\sHTTP2($|\s)'; then
    12     echo "Curl not found or does not support HTTP/2, skipping." 2>&1
    13     exit 77
    14 fi
    15 
    162. ${srcdir}/netns_py.bash ${srcdir}/runtest.py --test-number 28
  • test/test-34_TLS_reverse_proxy_h2.bash

    rbaa0056 r0f52d48  
    11#!/bin/bash
    2 for mod in mod_http2.so mod_proxy_http2.so; do
    3     if [ ! -r "${AP_LIBEXECDIR}/${mod}" ]; then
    4         echo "${mod} not found, skipping." 2>&1
    5         exit 77
    6     fi
    7 done
    82. ${srcdir}/netns_py.bash ${srcdir}/runtest.py --test-number 34
  • test/tests/27_OCSP_server/hooks.py

    rbaa0056 r0f52d48  
     1import os
    12import re
    23from mgstest import require_match
     4from unittest import SkipTest
     5
     6def prepare_env():
     7    if not 'OCSP_PORT' in os.environ:
     8        raise SkipTest('OCSP_PORT is not set, check if openssl is available.')
    39
    410def post_check(conn_log, response_log):
  • test/tests/28_HTTP2_support/hooks.py

    rbaa0056 r0f52d48  
    22import re
    33import subprocess
    4 from mgstest import require_match
     4from mgstest import require_apache_modules, require_match
     5from unittest import SkipTest
     6
     7def prepare_env():
     8    require_apache_modules('mod_http2.so')
     9    curl = os.environ['HTTP_CLI']
     10    if curl == 'no':
     11        raise SkipTest(f'{curl} not found!')
     12    proc = subprocess.run([curl, '-V'], stdout=subprocess.PIPE,
     13                          check=True, text=True)
     14    if not re.search(r'\bHTTP2\b', proc.stdout):
     15        raise SkipTest(f'{curl} does not support HTTP/2!')
    516
    617def run_connection(testname, conn_log, response_log):
     18    """Check if HTTP/2 connections using mod_gnutls and mod_http2 work."""
     19
    720    url = f'https://{os.environ["TEST_HOST"]}:{os.environ["TEST_PORT"]}' \
    821        '/status?auto'
  • test/tests/Makefile.am

    rbaa0056 r0f52d48  
    3434        32_vhost_SNI_serveralias_mismatch/apache.conf 32_vhost_SNI_serveralias_mismatch/test.yml \
    3535        33_vhost_SNI_serveralias_missinghost/apache.conf 33_vhost_SNI_serveralias_missinghost/test.yml \
    36         34_TLS_reverse_proxy_h2/apache.conf 34_TLS_reverse_proxy_h2/backend.conf 34_TLS_reverse_proxy_h2/test.yml
     36        34_TLS_reverse_proxy_h2/apache.conf 34_TLS_reverse_proxy_h2/hooks.py 34_TLS_reverse_proxy_h2/backend.conf 34_TLS_reverse_proxy_h2/test.yml
Note: See TracChangeset for help on using the changeset viewer.