Bläddra i källkod

Ticket 48832 - Fix CI tests failures from jenkins server

Description:  Fix the final test failures as seen on a jenkins server.  Typically
              all of these are timing issues that just require sleeps between certain
              tasks/commands.

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

Reviewed by: ?
Mark Reynolds 9 år sedan
förälder
incheckning
6f91ff58f2

+ 6 - 0
dirsrvtests/tests/suites/password/pwp_history_test.py

@@ -2,6 +2,7 @@ import os
 import ldap
 import logging
 import pytest
+import time
 from lib389 import DirSrv, Entry
 from lib389._constants import *
 from lib389.properties import *
@@ -77,6 +78,7 @@ def test_pwp_history_test(topology):
     except ldap.LDAPError as e:
         log.fatal('Failed to configure password policy: ' + str(e))
         assert False
+    time.sleep(1)
 
     try:
         topology.standalone.add_s(Entry((USER_DN, {
@@ -126,6 +128,7 @@ def test_pwp_history_test(topology):
     except ldap.LDAPError as e:
         log.fatal('Failed to bind as user using "password1": ' + str(e))
         assert False
+    time.sleep(1)
 
     # password2
     try:
@@ -139,6 +142,7 @@ def test_pwp_history_test(topology):
     except ldap.LDAPError as e:
         log.fatal('Failed to bind as user using "password2": ' + str(e))
         assert False
+    time.sleep(1)
 
     # password3
     try:
@@ -152,6 +156,7 @@ def test_pwp_history_test(topology):
     except ldap.LDAPError as e:
         log.fatal('Failed to bind as user using "password3": ' + str(e))
         assert False
+    time.sleep(1)
 
     # password4
     try:
@@ -165,6 +170,7 @@ def test_pwp_history_test(topology):
     except ldap.LDAPError as e:
         log.fatal('Failed to bind as user using "password4": ' + str(e))
         assert False
+    time.sleep(1)
 
     #
     # Check that we only have 3 passwords stored in history\

+ 8 - 4
dirsrvtests/tests/tickets/ticket1347760_test.py

@@ -7,15 +7,12 @@
 # --- END COPYRIGHT BLOCK ---
 #
 import os
-import sys
 import time
 import ldap
 import logging
 import pytest
-
 from subprocess import Popen
-from lib389 import DirSrv, Entry, tools, tasks
-from lib389.tools import DirSrvTools
+from lib389 import DirSrv, Entry
 from lib389._constants import *
 from lib389.properties import *
 from lib389.tasks import *
@@ -151,6 +148,7 @@ def check_op_result(server, op, dn, superior, exists, rc):
         expstr = 'fail with %s' % rc.__name__
 
     log.info('%s %s, which should %s.' % (opstr, targetdn, expstr))
+    time.sleep(1)
     hit = 0
     try:
         if op == 'search':
@@ -253,6 +251,7 @@ def test_ticket1347760(topology):
             assert False
         else:
             log.info('Cause found - %s' % cause)
+    time.sleep(1)
 
     log.info('Bind case 2-2. the bind user\'s suffix does not exist, bind should fail with error %s' % ldap.INVALID_CREDENTIALS.__name__)
     log.info('Bind as {%s,%s} who does not exist.' % (BOGUSSUFFIX, 'bogus'))
@@ -269,6 +268,7 @@ def test_ticket1347760(topology):
             assert False
         else:
             log.info('Cause found - %s' % cause)
+    time.sleep(1)
 
     log.info('Bind case 2-3. the bind user\'s password is wrong, bind should fail with error %s' % ldap.INVALID_CREDENTIALS.__name__)
     log.info('Bind as {%s,%s} who does not exist.' % (BINDDN, 'bogus'))
@@ -285,6 +285,7 @@ def test_ticket1347760(topology):
             assert False
         else:
             log.info('Cause found - %s' % cause)
+    time.sleep(1)
 
     log.info('Adding aci for %s to %s.' % (BINDDN, BINDOU))
     acival = '(targetattr="*")(version 3.0; acl "%s"; allow(all) userdn = "ldap:///%s";)' % (BUID, BINDDN)
@@ -292,6 +293,7 @@ def test_ticket1347760(topology):
     log.info('Bind as {%s,%s}' % (DN_DM, PASSWORD))
     topology.standalone.simple_bind_s(DN_DM, PASSWORD)
     topology.standalone.modify_s(BINDOU, [(ldap.MOD_ADD, 'aci', acival)])
+    time.sleep(1)
 
     log.info('Bind case 3. the bind user has the right to read the entry itself, bind should be successful.')
     log.info('Bind as {%s,%s} which should be ok.\n' % (BINDDN, BINDPW))
@@ -399,6 +401,7 @@ def test_ticket1347760(topology):
     log.info('Bind as {%s,%s}' % (DN_DM, PASSWORD))
     topology.standalone.simple_bind_s(DN_DM, PASSWORD)
     topology.standalone.modify_s(DEFAULT_SUFFIX, [(ldap.MOD_ADD, 'aci', acival)])
+    time.sleep(1)
 
     log.info('Bind as {%s,%s}.' % (BINDDN, BINDPW))
     try:
@@ -406,6 +409,7 @@ def test_ticket1347760(topology):
     except ldap.LDAPError as e:
         log.info('Desc ' + e.message['desc'])
         assert False
+    time.sleep(1)
 
     exists = False
     rc = ldap.NO_SUCH_OBJECT

+ 1 - 0
dirsrvtests/tests/tickets/ticket47823_test.py

@@ -436,6 +436,7 @@ def _config_file(topology, action='save'):
         shutil.copy(dse_ldif, sav_file)
     else:
         shutil.copy(sav_file, dse_ldif)
+    time.sleep(1)
 
 
 def _pattern_errorlog(file, log_pattern):

+ 15 - 0
dirsrvtests/tests/tickets/ticket47838_test.py

@@ -259,6 +259,7 @@ def test_47838_run_1(topology):
     topology.standalone.stop(timeout=10)
     os.system('mv %s %s.47838_0' % (topology.standalone.errlog, topology.standalone.errlog))
     os.system('touch %s' % (topology.standalone.errlog))
+    time.sleep(1)
     topology.standalone.start(timeout=120)
 
     enabled = os.popen('egrep "SSL alert:" %s | egrep \": enabled\" | wc -l' % topology.standalone.errlog)
@@ -298,6 +299,7 @@ def test_47838_run_2(topology):
     topology.standalone.stop(timeout=10)
     os.system('mv %s %s.47838_1' % (topology.standalone.errlog, topology.standalone.errlog))
     os.system('touch %s' % (topology.standalone.errlog))
+    time.sleep(1)
     topology.standalone.start(timeout=120)
 
     enabled = os.popen('egrep "SSL alert:" %s | egrep \": enabled\" | wc -l' % topology.standalone.errlog)
@@ -330,6 +332,7 @@ def test_47838_run_3(topology):
     topology.standalone.stop(timeout=10)
     os.system('mv %s %s.47838_2' % (topology.standalone.errlog, topology.standalone.errlog))
     os.system('touch %s' % (topology.standalone.errlog))
+    time.sleep(1)
     topology.standalone.start(timeout=120)
 
     enabled = os.popen('egrep "SSL alert:" %s | egrep \": enabled\" | wc -l' % topology.standalone.errlog)
@@ -361,6 +364,7 @@ def test_47838_run_4(topology):
     topology.standalone.stop(timeout=10)
     os.system('mv %s %s.47838_3' % (topology.standalone.errlog, topology.standalone.errlog))
     os.system('touch %s' % (topology.standalone.errlog))
+    time.sleep(1)
     topology.standalone.start(timeout=120)
 
     enabled = os.popen('egrep "SSL alert:" %s | egrep \": enabled\" | wc -l' % topology.standalone.errlog)
@@ -400,6 +404,7 @@ def test_47838_run_5(topology):
     topology.standalone.stop(timeout=10)
     os.system('mv %s %s.47838_4' % (topology.standalone.errlog, topology.standalone.errlog))
     os.system('touch %s' % (topology.standalone.errlog))
+    time.sleep(1)
     topology.standalone.start(timeout=120)
 
     enabled = os.popen('egrep "SSL alert:" %s | egrep \": enabled\" | wc -l' % topology.standalone.errlog)
@@ -439,6 +444,7 @@ def test_47838_run_6(topology):
     topology.standalone.stop(timeout=10)
     os.system('mv %s %s.47838_5' % (topology.standalone.errlog, topology.standalone.errlog))
     os.system('touch %s' % (topology.standalone.errlog))
+    time.sleep(1)
     topology.standalone.start(timeout=120)
 
     enabled = os.popen('egrep "SSL alert:" %s | egrep \": enabled\" | wc -l' % topology.standalone.errlog)
@@ -473,6 +479,7 @@ def test_47838_run_7(topology):
     topology.standalone.stop(timeout=10)
     os.system('mv %s %s.47838_6' % (topology.standalone.errlog, topology.standalone.errlog))
     os.system('touch %s' % (topology.standalone.errlog))
+    time.sleep(1)
     topology.standalone.start(timeout=120)
 
     enabled = os.popen('egrep "SSL alert:" %s | egrep \": enabled\" | wc -l' % topology.standalone.errlog)
@@ -505,6 +512,7 @@ def test_47838_run_8(topology):
     topology.standalone.stop(timeout=10)
     os.system('mv %s %s.47838_7' % (topology.standalone.errlog, topology.standalone.errlog))
     os.system('touch %s' % (topology.standalone.errlog))
+    time.sleep(1)
     topology.standalone.start(timeout=120)
 
     enabled = os.popen('egrep "SSL alert:" %s | egrep \": enabled\" | wc -l' % topology.standalone.errlog)
@@ -547,6 +555,7 @@ def test_47838_run_9(topology):
     topology.standalone.stop(timeout=10)
     os.system('mv %s %s.47838_8' % (topology.standalone.errlog, topology.standalone.errlog))
     os.system('touch %s' % (topology.standalone.errlog))
+    time.sleep(1)
     topology.standalone.start(timeout=120)
 
     enabled = os.popen('egrep "SSL alert:" %s | egrep \": enabled\" | wc -l' % topology.standalone.errlog)
@@ -595,6 +604,7 @@ def test_47838_run_10(topology):
     topology.standalone.stop(timeout=10)
     os.system('mv %s %s.47838_9' % (topology.standalone.errlog, topology.standalone.errlog))
     os.system('touch %s' % (topology.standalone.errlog))
+    time.sleep(1)
     topology.standalone.start(timeout=120)
 
     enabled = os.popen('egrep "SSL alert:" %s | egrep \": enabled\" | wc -l' % topology.standalone.errlog)
@@ -631,6 +641,7 @@ def test_47838_run_11(topology):
     topology.standalone.stop(timeout=10)
     os.system('mv %s %s.47838_10' % (topology.standalone.errlog, topology.standalone.errlog))
     os.system('touch %s' % (topology.standalone.errlog))
+    time.sleep(1)
     topology.standalone.start(timeout=120)
 
     errmsg = os.popen('egrep "SSL alert:" %s | egrep "is not available in NSS"' % topology.standalone.errlog)
@@ -668,6 +679,7 @@ def test_47928_run_0(topology):
     topology.standalone.stop(timeout=10)
     os.system('mv %s %s.47838_11' % (topology.standalone.errlog, topology.standalone.errlog))
     os.system('touch %s' % (topology.standalone.errlog))
+    time.sleep(1)
     topology.standalone.start(timeout=120)
 
     errmsg = os.popen('egrep "SSL alert:" %s | egrep "Default SSL Version settings; Configuring the version range as min: TLS1.1"' % topology.standalone.errlog)
@@ -729,6 +741,7 @@ def test_47928_run_2(topology):
     topology.standalone.stop(timeout=10)
     os.system('mv %s %s.47838_13' % (topology.standalone.errlog, topology.standalone.errlog))
     os.system('touch %s' % (topology.standalone.errlog))
+    time.sleep(1)
     topology.standalone.start(timeout=120)
 
     errmsg = os.popen('egrep "SSL alert:" %s | egrep "Found unsecure configuration: nsSSL3: on"' % topology.standalone.errlog)
@@ -773,6 +786,7 @@ def test_47928_run_3(topology):
     topology.standalone.stop(timeout=10)
     os.system('mv %s %s.47838_14' % (topology.standalone.errlog, topology.standalone.errlog))
     os.system('touch %s' % (topology.standalone.errlog))
+    time.sleep(1)
     topology.standalone.start(timeout=120)
 
     errmsg = os.popen('egrep "SSL alert:" %s | egrep "Found unsecure configuration: nsSSL3: on"' % topology.standalone.errlog)
@@ -815,6 +829,7 @@ def test_47838_run_last(topology):
     topology.standalone.stop(timeout=10)
     os.system('mv %s %s.47838_15' % (topology.standalone.errlog, topology.standalone.errlog))
     os.system('touch %s' % (topology.standalone.errlog))
+    time.sleep(1)
     topology.standalone.start(timeout=120)
 
     errmsg = os.popen('egrep "SSL alert:" %s | egrep "invalid ciphers"' % topology.standalone.errlog)

+ 11 - 0
dirsrvtests/tests/tickets/ticket48194_test.py

@@ -238,6 +238,7 @@ def test_run_1(topology):
     topology.standalone.stop(timeout=10)
     os.system('mv %s %s.48194_0' % (topology.standalone.errlog, topology.standalone.errlog))
     os.system('touch %s' % (topology.standalone.errlog))
+    time.sleep(1)
     topology.standalone.start(timeout=120)
 
     connectWithOpenssl(topology, 'RC4-SHA', False)
@@ -258,6 +259,7 @@ def test_run_2(topology):
     topology.standalone.stop(timeout=10)
     os.system('mv %s %s.48194_1' % (topology.standalone.errlog, topology.standalone.errlog))
     os.system('touch %s' % (topology.standalone.errlog))
+    time.sleep(1)
     topology.standalone.start(timeout=120)
 
     connectWithOpenssl(topology, 'RC4-SHA', False)
@@ -280,6 +282,7 @@ def test_run_3(topology):
     topology.standalone.stop(timeout=10)
     os.system('mv %s %s.48194_2' % (topology.standalone.errlog, topology.standalone.errlog))
     os.system('touch %s' % (topology.standalone.errlog))
+    time.sleep(1)
     topology.standalone.start(timeout=120)
 
     connectWithOpenssl(topology, 'RC4-SHA', False)
@@ -300,6 +303,7 @@ def test_run_4(topology):
     topology.standalone.stop(timeout=10)
     os.system('mv %s %s.48194_3' % (topology.standalone.errlog, topology.standalone.errlog))
     os.system('touch %s' % (topology.standalone.errlog))
+    time.sleep(1)
     topology.standalone.start(timeout=120)
 
     connectWithOpenssl(topology, 'RC4-SHA', False)
@@ -320,6 +324,7 @@ def test_run_5(topology):
     topology.standalone.stop(timeout=10)
     os.system('mv %s %s.48194_4' % (topology.standalone.errlog, topology.standalone.errlog))
     os.system('touch %s' % (topology.standalone.errlog))
+    time.sleep(1)
     topology.standalone.start(timeout=120)
 
     connectWithOpenssl(topology, 'RC4-SHA', False)
@@ -340,6 +345,7 @@ def test_run_6(topology):
     topology.standalone.stop(timeout=10)
     os.system('mv %s %s.48194_5' % (topology.standalone.errlog, topology.standalone.errlog))
     os.system('touch %s' % (topology.standalone.errlog))
+    time.sleep(1)
     topology.standalone.start(timeout=120)
 
     connectWithOpenssl(topology, 'RC4-SHA', False)
@@ -361,6 +367,7 @@ def test_run_7(topology):
     topology.standalone.stop(timeout=10)
     os.system('mv %s %s.48194_6' % (topology.standalone.errlog, topology.standalone.errlog))
     os.system('touch %s' % (topology.standalone.errlog))
+    time.sleep(1)
     topology.standalone.start(timeout=120)
 
     connectWithOpenssl(topology, 'RC4-SHA', False)
@@ -382,6 +389,7 @@ def test_run_8(topology):
     topology.standalone.stop(timeout=10)
     os.system('mv %s %s.48194_7' % (topology.standalone.errlog, topology.standalone.errlog))
     os.system('touch %s' % (topology.standalone.errlog))
+    time.sleep(1)
     topology.standalone.start(timeout=120)
 
     connectWithOpenssl(topology, 'RC4-SHA', False)
@@ -405,6 +413,7 @@ def test_run_9(topology):
     topology.standalone.stop(timeout=10)
     os.system('mv %s %s.48194_8' % (topology.standalone.errlog, topology.standalone.errlog))
     os.system('touch %s' % (topology.standalone.errlog))
+    time.sleep(1)
     topology.standalone.start(timeout=120)
 
     connectWithOpenssl(topology, 'RC4-SHA', True)
@@ -433,6 +442,7 @@ def test_run_10(topology):
     topology.standalone.stop(timeout=10)
     os.system('mv %s %s.48194_9' % (topology.standalone.errlog, topology.standalone.errlog))
     os.system('touch %s' % (topology.standalone.errlog))
+    time.sleep(1)
     topology.standalone.start(timeout=120)
 
     connectWithOpenssl(topology, 'RC4-SHA', False)
@@ -453,6 +463,7 @@ def test_run_11(topology):
     topology.standalone.stop(timeout=10)
     os.system('mv %s %s.48194_10' % (topology.standalone.errlog, topology.standalone.errlog))
     os.system('touch %s' % (topology.standalone.errlog))
+    time.sleep(1)
     topology.standalone.start(timeout=120)
 
     connectWithOpenssl(topology, 'RC4-SHA', False)

+ 12 - 6
dirsrvtests/tests/tickets/ticket48755_test.py

@@ -127,19 +127,16 @@ def topology(request):
         master2.delete()
     request.addfinalizer(fin)
 
-    # Clear out the tmp dir
-    master1.clearTmpDir(__file__)
-
     return TopologyReplication(master1, master2)
 
 
 @pytest.fixture(scope="module")
-
 def add_ou_entry(server, idx, myparent):
     name = 'OU%d' % idx
     dn = 'ou=%s,%s' % (name, myparent)
     server.add_s(Entry((dn, {'objectclass': ['top', 'organizationalunit'],
                              'ou': name})))
+    time.sleep(1)
 
 
 def add_user_entry(server, idx, myparent):
@@ -150,12 +147,14 @@ def add_user_entry(server, idx, myparent):
                              'sn': 'user%d' % idx,
                              'cn': 'Test User%d' % idx,
                              'userpassword': 'password'})))
+    time.sleep(1)
 
 
 def del_user_entry(server, idx, myparent):
     name = 'tuser%d' % idx
     dn = 'uid=%s,%s' % (name, myparent)
     server.delete_s(dn)
+    time.sleep(1)
 
 
 def add_ldapsubentry(server, myparent):
@@ -190,6 +189,7 @@ def add_ldapsubentry(server, myparent):
                               'costemplatedn': '%s' % tmpldn,
                               'cosAttribute': 'pwdpolicysubentry default operational-default',
                               'cn': '%s' % name})))
+    time.sleep(1)
 
 
 def test_ticket48755(topology):
@@ -228,10 +228,12 @@ def test_ticket48755(topology):
 
     log.info("Moving %s to DIT_1" % parent00)
     M1.rename_s(parent00, ou0, newsuperior=parent1, delold=1)
+    time.sleep(1)
 
     log.info("Moving %s to DIT_1" % parent0)
     parent01 = '%s,%s' % (ou0, parent1)
     M1.rename_s(parent0, ou0, newsuperior=parent01, delold=1)
+    time.sleep(1)
 
     parent001 = '%s,%s' % (ou0, parent01)
     log.info("Moving USERS to %s" % parent0)
@@ -241,6 +243,7 @@ def test_ticket48755(topology):
             rdn = 'uid=%s' % name
             dn = 'uid=%s,%s' % (name, parent01)
             M1.rename_s(dn, rdn, newsuperior=parent001, delold=1)
+            time.sleep(1)
 
     log.info('%s => %s => %s => %s => 10 USERS' % (DEFAULT_SUFFIX, parent1, parent01, parent001))
 
@@ -248,9 +251,12 @@ def test_ticket48755(topology):
     global m1_m2_agmt
     M1.startReplication_async(m1_m2_agmt)
     M1.waitForReplInit(m1_m2_agmt)
+    time.sleep(2)
 
-    m1entries = M1.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE, '(|(objectclass=ldapsubentry)(objectclass=nstombstone)(nsuniqueid=*))')
-    m2entries = M2.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE, '(|(objectclass=ldapsubentry)(objectclass=nstombstone)(nsuniqueid=*))')
+    m1entries = M1.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE,
+                            '(|(objectclass=ldapsubentry)(objectclass=nstombstone)(nsuniqueid=*))')
+    m2entries = M2.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE,
+                            '(|(objectclass=ldapsubentry)(objectclass=nstombstone)(nsuniqueid=*))')
 
     log.info("m1entry count - %d", len(m1entries))
     log.info("m2entry count - %d", len(m2entries))