Add backported fixes for test failures

Add backported fix to the tests to wait a reasonable amount of time
after calling the 'resubmit' method for a new certificate to be issued
when we're exercising the D-Bus API (backport done by Jan Cholasta,
This commit is contained in:
Nalin Dahyabhai 2016-07-06 14:31:36 -04:00
parent 93e4828d8d
commit 3f8a64cc9e
2 changed files with 67 additions and 1 deletions

View File

@ -0,0 +1,59 @@
From 4f72c02d0f432519f9d5606bd99007fd685482a7 Mon Sep 17 00:00:00 2001
From: Nalin Dahyabhai <nalin@redhat.com>
Date: Wed, 29 Jun 2016 17:37:09 -0400
Subject: [PATCH] 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.
---
tests/028-dbus/expected.out | 1 +
tests/028-dbus/walk.py | 8 ++++++++
2 files changed, 9 insertions(+)
diff --git a/tests/028-dbus/expected.out b/tests/028-dbus/expected.out
index b2660317b3102373f2a5a877a7224f727929412c..93cc4d184524c4b1aeba02a650c94d832462c236 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 0bf54b477220aef901340c1d24100391348226a7..f60ca934fd934e21cec027bad5c53e0f12ccb36d 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):
--
2.7.4

View File

@ -26,7 +26,7 @@
Name: certmonger
Version: 0.78.6
Release: 3%{?dist}
Release: 4%{?dist}
Summary: Certificate status monitor and PKI enrollment client
Group: System Environment/Daemons
@ -34,6 +34,7 @@ License: GPLv3+
URL: http://certmonger.fedorahosted.org
Source0: http://fedorahosted.org/released/certmonger/certmonger-%{version}.tar.gz
Source1: http://fedorahosted.org/released/certmonger/certmonger-%{version}.tar.gz.sig
Patch0: 0009-Fix-a-flakiness-in-the-028-dbus-test.patch
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires: openldap-devel
@ -114,6 +115,7 @@ system enrolled with a certificate authority (CA) and keeping it enrolled.
%prep
%setup -q
%patch0 -p1 -b .testrace
%if 0%{?rhel} > 0
# Enabled by default for RHEL for bug #765600, still disabled by default for
# Fedora pending a similar bug report there.
@ -243,6 +245,11 @@ exit 0
%endif
%changelog
* Wed Jul 6 2016 Nalin Dahyabhai <nalin@redhat.com> 0.78.6-4
- add backported fix to wait a reasonable amount of time after calling the
'resubmit' method for a new certificate to be issued when we're exercising
the D-Bus API during tests (Jan Cholasta, #1351052)
* Wed Jul 6 2016 Nalin Dahyabhai <nalin@redhat.com> 0.78.6-3
- instead of using killall to send a SIGHUP to the system bus daemon in %%post
to get it to reload its configuration, use dbus-send to send a ReloadConfig