From 674789e4da5b9389ec285289ea1924c724b8d2cc Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Jun 29 2016 21:41:15 +0000 Subject: Fix a flakiness in the 028-dbus test When walking all of the exposed APIs from python, we were calling the 'resubmit' method on a certificate, and not waiting for the churn in state that doing so would create to settle down before continuing. This meant that the test script might have exited before the certmonger process that was waiting on it finished saving the new certificate that it obtained from resubmitting the rquest, so the process wouldn't reliably log that it had obtained a new certificate. Spotted by Jan Cholasta. --- diff --git a/tests/028-dbus/expected.out b/tests/028-dbus/expected.out index b266031..93cc4d1 100644 --- a/tests/028-dbus/expected.out +++ b/tests/028-dbus/expected.out @@ -1,4 +1,5 @@ Certificate in file "${tmpdir}/test.crt" issued by CA and saved. +Certificate in file "${tmpdir}/test.crt" issued by CA and saved. [[ getcert ]] State MONITORING, stuck: no. Number of certificates and requests being tracked: 1. diff --git a/tests/028-dbus/walk.py b/tests/028-dbus/walk.py index 0bf54b4..f60ca93 100644 --- a/tests/028-dbus/walk.py +++ b/tests/028-dbus/walk.py @@ -3,6 +3,7 @@ import dbus import xml.etree.ElementTree import os import sys +import time bus = dbus.SessionBus() @@ -110,6 +111,13 @@ def examine_method(objpath, interface, method, idata): # We're in FIXME territory. print('FIXME: need support for "%s"' % method) return False + # If we caused things to start churning, wait for them to settle. + if method == 'resubmit': + props = dbus.Interface(o, 'org.freedesktop.DBus.Properties') + prop = props.Get(interface, 'status') + while prop != 'MONITORING': + time.sleep(1) + prop = props.Get(interface, 'status') return True def iget(child, proxy, interface, prop):