Changeset 4fb510d in mod_gnutls for test/runtests


Ignore:
Timestamp:
Mar 5, 2017, 11:55:51 AM (3 years ago)
Author:
Thomas Klute <thomas2.klute@…>
Branches:
debian/master, debian/stretch-backports, master, upstream
Children:
339a49d
Parents:
5f3222b
Message:

Test suite: Add generic function to wait for a command to succeed

The command is retried with a configurable wait time until it
succeeds, or a timeout expires. This is intended to wait for a service
to become ready, e.g. the OCSP responder or MSVA service used in
tests.

The MSVA and OCSP responder availability tests are modified to use the
new function.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/runtests

    r5f3222b r4fb510d  
    1919
    2020BADVARS=0
    21 for v in APACHE2 TEST_HOST TEST_PORT TEST_QUERY_TIMEOUT TEST_MSVA_WAIT \
     21for v in APACHE2 TEST_HOST TEST_PORT TEST_QUERY_TIMEOUT TEST_SERVICE_WAIT \
    2222                 MSVA_PORT; do
    2323    if [ ! -v "$v" ]; then
     
    127127
    128128    printf "TESTING: initial MSVA verification\n"
    129     # set to 0 if MSVA is up
    130     ret=1
    131129    export MONKEYSPHERE_VALIDATION_AGENT_SOCKET="http://127.0.0.1:$MSVA_PORT"
    132130
    133     # convert TEST_MSVA_WAIT to seconds because that's what "sleep" expects
    134     TEST_MSVA_SLEEP="$((${TEST_MSVA_WAIT} / 1000)).$((${TEST_MSVA_WAIT} % 1000))"
    135     # wait at most TEST_MSVA_MAX_WAIT milliseconds for MSVA to get ready
    136     waited=0
    137     until [ ${ret} -eq 0 ] \
    138               || [ ${waited} -ge ${TEST_MSVA_MAX_WAIT} ]; do
    139         if msva-query-agent https "$(cat client.uid)" x509pem client < client/x509.pem
    140         then
    141             ret=0
    142         else
    143             echo "MSVA not ready yet"
    144         fi
    145         sleep "${TEST_MSVA_SLEEP}"
    146         waited=$((${waited} + ${TEST_MSVA_WAIT}))
    147     done
    148 
     131    msva_test_cmd="msva-query-agent https \"$(cat client.uid)\" x509pem client < client/x509.pem"
    149132    # check if MSVA is up, fail if not
    150     if [ ${ret} -eq 0 ]; then
     133    if wait_ready "${msva_test_cmd}"; then
    151134        printf "\nSUCCESS: initial MSVA verification\n"
    152135    else
     
    207190    fi
    208191    echo "---- Testing OCSP server ----"
    209     ocsptool --ask --nonce --load-issuer authority/x509.pem --load-cert server/x509.pem ${store_ocsp}
     192    wait_ready "ocsptool --ask --nonce --load-issuer authority/x509.pem --load-cert server/x509.pem ${store_ocsp}"
    210193    echo "---- OCSP test done ----"
    211194fi
Note: See TracChangeset for help on using the changeset viewer.