Blame SOURCES/0009-Fix-a-flakiness-in-the-028-dbus-test.patch

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