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

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