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

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