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

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