Changeset 65e66c9 in mod_gnutls for test/runtest.py


Ignore:
Timestamp:
Nov 28, 2020, 3:46:31 PM (3 months ago)
Author:
Fiona Klute <fiona.klute@…>
Branches:
asyncio
Parents:
7eb4233
Message:

Turn "service ready" check functions into coroutines

This way checks that call subprocesses don't block other tasks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/runtest.py

    r7eb4233 r65e66c9  
    6565
    6666
    67 def check_ocsp_responder():
     67async def check_ocsp_responder():
    6868    # Check if OCSP responder works
    6969    issuer_cert = 'authority/x509.pem'
    7070    check_cert = 'authority/server/x509.pem'
    71     command = ['ocsptool', '--ask', '--nonce',
    72                '--load-issuer', issuer_cert,
    73                '--load-cert', check_cert]
    74     return subprocess.run(command).returncode == 0
    75 
    76 
    77 def check_msva():
     71    proc = await asyncio.create_subprocess_exec(
     72        'ocsptool', '--ask', '--nonce',
     73        '--load-issuer', issuer_cert, '--load-cert', check_cert)
     74    return (await proc.wait()) == 0
     75
     76
     77async def check_msva():
    7878    # Check if MSVA is up
    7979    cert_file = 'authority/client/x509.pem'
     
    8181    with open(uid_file, 'r') as file:
    8282        uid = file.read().strip()
    83         command = ['msva-query-agent', 'https', uid, 'x509pem', 'client']
    84         with open(cert_file, 'r') as cert:
    85             return subprocess.run(command, stdin=cert).returncode == 0
     83    with open(cert_file, 'r') as cert:
     84        proc = await asyncio.create_subprocess_exec(
     85            'msva-query-agent', 'https', uid, 'x509pem', 'client',
     86            stdin=cert)
     87        return (await proc.wait()) == 0
    8688
    8789
Note: See TracChangeset for help on using the changeset viewer.