From 5d04b30ea3735e6091f96f08d749de654229680e Mon Sep 17 00:00:00 2001
From: Mark Reynolds <mreynolds@redhat.com>
Date: Wed, 31 Aug 2016 12:19:15 -0400
Subject: [PATCH] Ticket 48832 - Fix CI tests

Description:  More timing issues with some CI tests.  Need to add
              short sleeps in between certain operations.

https://fedorahosted.org/389/ticket/48832

Reviewed by: ?
---
 dirsrvtests/tests/tickets/ticket48784_test.py | 10 +++++++---
 dirsrvtests/tests/tickets/ticket48798_test.py | 15 +++++++++++++++
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/dirsrvtests/tests/tickets/ticket48784_test.py b/dirsrvtests/tests/tickets/ticket48784_test.py
index 2898807..3559a48 100644
--- a/dirsrvtests/tests/tickets/ticket48784_test.py
+++ b/dirsrvtests/tests/tickets/ticket48784_test.py
@@ -180,6 +180,7 @@ def enable_ssl(server, ldapsport, mycert):
                                  'nsSSLPersonalitySSL': mycert,
                                  'nsSSLToken': 'internal (software)',
                                  'nsSSLActivation': 'on'})))
+    time.sleep(1)
 
 
 def doAndPrintIt(cmdline, filename):
@@ -229,6 +230,7 @@ def create_keys_certs(topology):
     pwdfd = open(pwdfile, "w")
     pwdfd.write(passwd)
     pwdfd.close()
+    time.sleep(1)
 
     log.info("##### create the pin file")
     m1pinfile = '%s/pin.txt' % (m1confdir)
@@ -297,6 +299,7 @@ def create_keys_certs(topology):
     cmd = 'pk12util -o %s -n "%s" -d %s -w %s -k %s' % (m2pk12file, M2SERVERCERT, m1confdir, pwdfile, pwdfile)
     log.info("##### Extract PK12 file for master2: %s" % cmd)
     os.system(cmd)
+    time.sleep(1)
 
     log.info("##### Check PK12 files")
     if os.path.isfile(m2pk12file):
@@ -323,6 +326,7 @@ def create_keys_certs(topology):
     log.info('copy %s to %s' % (m1pinfile, m2pinfile))
     os.system('cp %s %s' % (m1pinfile, m2pinfile))
     os.system('chmod 400 %s' % m2pinfile)
+    time.sleep(1)
 
     log.info("##### start master2")
     topology.master2.start(timeout=10)
@@ -331,10 +335,10 @@ def create_keys_certs(topology):
     enable_ssl(topology.master2, M2LDAPSPORT, M2SERVERCERT)
 
     log.info("##### restart master2")
-    topology.master2.restart(timeout=10)
+    topology.master2.restart(timeout=30)
 
     log.info("##### restart master1")
-    topology.master1.restart(timeout=10)
+    topology.master1.restart(timeout=30)
 
     log.info("\n######################### Creating SSL Keys and Certs Done ######################\n")
 
@@ -418,7 +422,7 @@ def test_ticket48784(topology):
     log.info("##### replication from master_2 to master_1 should fail.")
     add_entry(topology.master2, 'master2', 'uid=m2user', 10, 1)
 
-    time.sleep(2)
+    time.sleep(10)
 
     log.info('##### Searching for entries on master1...')
     entries = topology.master1.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE, '(uid=*)')
diff --git a/dirsrvtests/tests/tickets/ticket48798_test.py b/dirsrvtests/tests/tickets/ticket48798_test.py
index f6f3911..297e2ef 100644
--- a/dirsrvtests/tests/tickets/ticket48798_test.py
+++ b/dirsrvtests/tests/tickets/ticket48798_test.py
@@ -84,24 +84,39 @@ def test_ticket48798(topology):
 
     # Check if the db exists. Should be false.
     assert(topology.standalone.nss_ssl._db_exists() is False)
+    time.sleep(0.5)
+
     # Create it. Should work.
     assert(topology.standalone.nss_ssl.reinit() is True)
+    time.sleep(0.5)
+
     # Check if the db exists. Should be true
     assert(topology.standalone.nss_ssl._db_exists() is True)
+    time.sleep(0.5)
 
     # Check if ca exists. Should be false.
     assert(topology.standalone.nss_ssl._rsa_ca_exists() is False)
+    time.sleep(0.5)
+
     # Create it. Should work.
     assert(topology.standalone.nss_ssl.create_rsa_ca() is True)
+    time.sleep(0.5)
+
     # Check if ca exists. Should be true
     assert(topology.standalone.nss_ssl._rsa_ca_exists() is True)
+    time.sleep(0.5)
 
     # Check if we have a server cert / key. Should be false.
     assert(topology.standalone.nss_ssl._rsa_key_and_cert_exists() is False)
+    time.sleep(0.5)
+
     # Create it. Should work.
     assert(topology.standalone.nss_ssl.create_rsa_key_and_cert() is True)
+    time.sleep(0.5)
+
     # Check if server cert and key exist. Should be true.
     assert(topology.standalone.nss_ssl._rsa_key_and_cert_exists() is True)
+    time.sleep(0.5)
 
     topology.standalone.config.enable_ssl(secport=DEFAULT_SECURE_PORT, secargs={'nsSSL3Ciphers': '+all'} )
 
-- 
2.7.4

