dirsrvtests/tickets/create_testcase.py | 29 +++++----------------
dirsrvtests/tickets/ticket47462_test.py | 17 ++----------
dirsrvtests/tickets/ticket47490_test.py | 18 ++-----------
dirsrvtests/tickets/ticket47553_ger.py | 18 ++-----------
dirsrvtests/tickets/ticket47553_single_aci_test.py | 18 ++-----------
dirsrvtests/tickets/ticket47573_test.py | 21 ++++-----------
dirsrvtests/tickets/ticket47619_test.py | 18 ++-----------
dirsrvtests/tickets/ticket47653MMR_test.py | 18 ++-----------
dirsrvtests/tickets/ticket47676_test.py | 18 ++-----------
dirsrvtests/tickets/ticket47721_test.py | 18 ++-----------
dirsrvtests/tickets/ticket47787_test.py | 18 ++-----------
dirsrvtests/tickets/ticket47869MMR_test.py | 17 ++----------
dirsrvtests/tickets/ticket47871_test.py | 18 ++-----------
dirsrvtests/tickets/ticket47988_test.py | 18 ++-----------
14 files changed, 62 insertions(+), 202 deletions(-)
New commits:
commit 4681fab27a1983c1fc1ae91eb45e25d3fcd28bf8
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Tue Feb 3 09:54:01 2015 -0500
Ticket 48023 - replace old replication check with lib389 function
Description: Replaced the old "replication is working" check with
lib389's more robust replication check function.
https://fedorahosted.org/389/ticket/48023
Reviewed by: nhosoi(Thanks!)
diff --git a/dirsrvtests/tickets/create_testcase.py
b/dirsrvtests/tickets/create_testcase.py
index 092c56d..1fa2963 100644
--- a/dirsrvtests/tickets/create_testcase.py
+++ b/dirsrvtests/tickets/create_testcase.py
@@ -168,7 +168,7 @@ if len(sys.argv) > 0:
# Write the 'topology function'
#
TEST.write('(a)pytest.fixture(scope="module")\n')
- TEST.write('def topology(request): \n')
+ TEST.write('def topology(request):\n')
TEST.write(' global installation1_prefix\n')
TEST.write(' if installation1_prefix:\n')
TEST.write(' args_instance[SER_DEPLOYED_DIR] =
installation1_prefix\n\n')
@@ -391,16 +391,6 @@ if len(sys.argv) > 0:
# Write replicaton check
#
if agmt_count > 0:
- TEST.write(' #\n')
- TEST.write(' # Check replication is working...\n')
- TEST.write(' #\n')
- TEST.write(" REPL_TEST_DN = 'cn=test repl,' +
SUFFIX\n")
- TEST.write(' master1.add_s(Entry((REPL_TEST_DN, {\n')
- TEST.write(" 'objectclass': 'top
person'.split(),\n")
- TEST.write(" 'sn':
'test_repl',\n")
- TEST.write(" 'cn':
'test_repl'})))\n")
- TEST.write(' loop = 0\n')
- TEST.write(' ent = None\n')
# Find the lowest replica type in the deployment(consumer -> master)
if consumers > 0:
replica = 'consumer1'
@@ -408,14 +398,11 @@ if len(sys.argv) > 0:
replica = 'hub1'
else:
replica = 'master2'
- TEST.write(' while loop <= 10:\n')
- TEST.write(' try:\n')
- TEST.write(' ent = ' + replica +
'.getEntry(REPL_TEST_DN, ldap.SCOPE_BASE, "(objectclass=*)")\n')
- TEST.write(' break\n')
- TEST.write(' except ldap.NO_SUCH_OBJECT:\n')
- TEST.write(' time.sleep(1)\n')
- TEST.write(' loop += 1\n')
- TEST.write(' if ent is None:\n')
+ TEST.write(' # Check replication is working...\n')
+ TEST.write(' if master1.testReplication(DEFAULT_SUFFIX, ' +
replica + '):\n')
+ TEST.write(" log.info('Replication is
working.')\n")
+ TEST.write(' else:\n')
+ TEST.write(" log.fatal('Replication is not
working.')\n")
TEST.write(' assert False\n')
TEST.write('\n')
@@ -510,7 +497,6 @@ if len(sys.argv) > 0:
for idx in range(consumers):
idx += 1
TEST.write(' topology.consumer' + str(idx) +
'.delete()\n')
- TEST.write('\n\n')
else:
for idx in range(instances):
idx += 1
@@ -519,8 +505,9 @@ if len(sys.argv) > 0:
else:
idx = str(idx)
TEST.write(' topology.standalone' + idx + '.delete()\n')
- TEST.write('\n\n')
+
TEST.write(" log.info('Testcase PASSED')\n")
+ TEST.write('\n\n')
#
# Write the main function
diff --git a/dirsrvtests/tickets/ticket47462_test.py
b/dirsrvtests/tickets/ticket47462_test.py
index e385f1e..e757f6b 100644
--- a/dirsrvtests/tickets/ticket47462_test.py
+++ b/dirsrvtests/tickets/ticket47462_test.py
@@ -117,19 +117,10 @@ def topology(request):
master1.waitForReplInit(AGMT_DN)
# Check replication is working fine
- master1.add_s(Entry((TEST_REPL_DN, {'objectclass': "top
person".split(),
- 'sn': 'test_repl',
- 'cn': 'test_repl'})))
- loop = 0
- while loop <= 10:
- try:
- ent = master2.getEntry(TEST_REPL_DN, ldap.SCOPE_BASE,
"(objectclass=*)")
- break
- except ldap.NO_SUCH_OBJECT:
- time.sleep(1)
- loop += 1
- if not ent:
- log.fatal('Replication is not working!')
+ if master1.testReplication(DEFAULT_SUFFIX, master2):
+ log.info('Replication is working.')
+ else:
+ log.fatal('Replication is not working.')
assert False
# clear the tmp directory
diff --git a/dirsrvtests/tickets/ticket47490_test.py
b/dirsrvtests/tickets/ticket47490_test.py
index fc8e15a..e5cd888 100644
--- a/dirsrvtests/tickets/ticket47490_test.py
+++ b/dirsrvtests/tickets/ticket47490_test.py
@@ -240,20 +240,10 @@ def topology(request):
master.waitForReplInit(repl_agreement)
# Check replication is working fine
- master.add_s(Entry((TEST_REPL_DN, {
- 'objectclass': "top person".split(),
- 'sn': 'test_repl',
- 'cn': 'test_repl'})))
- ent = None
- loop = 0
- while loop <= 10:
- try:
- ent = consumer.getEntry(TEST_REPL_DN, ldap.SCOPE_BASE,
"(objectclass=*)")
- break
- except ldap.NO_SUCH_OBJECT:
- time.sleep(1)
- loop += 1
- if ent is None:
+ if master.testReplication(DEFAULT_SUFFIX, consumer):
+ log.info('Replication is working.')
+ else:
+ log.fatal('Replication is not working.')
assert False
# clear the tmp directory
diff --git a/dirsrvtests/tickets/ticket47553_ger.py
b/dirsrvtests/tickets/ticket47553_ger.py
index 5f0fbf2..715feb4 100644
--- a/dirsrvtests/tickets/ticket47553_ger.py
+++ b/dirsrvtests/tickets/ticket47553_ger.py
@@ -140,20 +140,10 @@ def topology(request):
master1.waitForReplInit(repl_agreement)
# Check replication is working fine
- master1.add_s(Entry((TEST_REPL_DN, {
- 'objectclass': "top person".split(),
- 'sn': 'test_repl',
- 'cn': 'test_repl'})))
- loop = 0
- ent = None
- while loop <= 10:
- try:
- ent = master2.getEntry(TEST_REPL_DN, ldap.SCOPE_BASE,
"(objectclass=*)")
- break
- except ldap.NO_SUCH_OBJECT:
- time.sleep(1)
- loop += 1
- if ent is None:
+ if master1.testReplication(DEFAULT_SUFFIX, master2):
+ log.info('Replication is working.')
+ else:
+ log.fatal('Replication is not working.')
assert False
# clear the tmp directory
diff --git a/dirsrvtests/tickets/ticket47553_single_aci_test.py
b/dirsrvtests/tickets/ticket47553_single_aci_test.py
index 30b7238..5537101 100644
--- a/dirsrvtests/tickets/ticket47553_single_aci_test.py
+++ b/dirsrvtests/tickets/ticket47553_single_aci_test.py
@@ -140,20 +140,10 @@ def topology(request):
master1.waitForReplInit(repl_agreement)
# Check replication is working fine
- master1.add_s(Entry((TEST_REPL_DN, {
- 'objectclass': "top person".split(),
- 'sn': 'test_repl',
- 'cn': 'test_repl'})))
- loop = 0
- ent = None
- while loop <= 10:
- try:
- ent = master2.getEntry(TEST_REPL_DN, ldap.SCOPE_BASE,
"(objectclass=*)")
- break
- except ldap.NO_SUCH_OBJECT:
- time.sleep(1)
- loop += 1
- if ent is None:
+ if master1.testReplication(DEFAULT_SUFFIX, master2):
+ log.info('Replication is working.')
+ else:
+ log.fatal('Replication is not working.')
assert False
# clear the tmp directory
diff --git a/dirsrvtests/tickets/ticket47573_test.py
b/dirsrvtests/tickets/ticket47573_test.py
index 1771049..6fcbec7 100644
--- a/dirsrvtests/tickets/ticket47573_test.py
+++ b/dirsrvtests/tickets/ticket47573_test.py
@@ -186,20 +186,10 @@ def topology(request):
master.waitForReplInit(repl_agreement)
# Check replication is working fine
- master.add_s(Entry((TEST_REPL_DN, {
- 'objectclass': "top person".split(),
- 'sn': 'test_repl',
- 'cn': 'test_repl'})))
- loop = 0
- ent = None
- while loop <= 10:
- try:
- ent = consumer.getEntry(TEST_REPL_DN, ldap.SCOPE_BASE,
"(objectclass=*)")
- break
- except ldap.NO_SUCH_OBJECT:
- time.sleep(1)
- loop += 1
- if ent is None:
+ if master.testReplication(DEFAULT_SUFFIX, consumer):
+ log.info('Replication is working.')
+ else:
+ log.fatal('Replication is not working.')
assert False
# clear the tmp directory
@@ -214,7 +204,8 @@ def test_ticket47573_init(topology):
"""
Initialize the test environment
"""
- log.debug("test_ticket47573_init topology %r (master %r, consumer %r" %
(topology, topology.master, topology.consumer))
+ log.debug("test_ticket47573_init topology %r (master %r, consumer %r" %
+ (topology, topology.master, topology.consumer))
# the test case will check if a warning message is logged in the
# error log of the supplier
topology.master.errorlog_file = open(topology.master.errlog, "r")
diff --git a/dirsrvtests/tickets/ticket47619_test.py
b/dirsrvtests/tickets/ticket47619_test.py
index 8475be1..9160afd 100644
--- a/dirsrvtests/tickets/ticket47619_test.py
+++ b/dirsrvtests/tickets/ticket47619_test.py
@@ -108,20 +108,10 @@ def topology(request):
master.waitForReplInit(repl_agreement)
# Check replication is working fine
- master.add_s(Entry((TEST_REPL_DN, {
- 'objectclass': "top
person".split(),
- 'sn': 'test_repl',
- 'cn': 'test_repl'})))
- loop = 0
- ent = None
- while loop <= 10:
- try:
- ent = consumer.getEntry(TEST_REPL_DN, ldap.SCOPE_BASE,
"(objectclass=*)")
- break
- except ldap.NO_SUCH_OBJECT:
- time.sleep(1)
- loop += 1
- if ent is None:
+ if master.testReplication(DEFAULT_SUFFIX, consumer):
+ log.info('Replication is working.')
+ else:
+ log.fatal('Replication is not working.')
assert False
# clear the tmp directory
diff --git a/dirsrvtests/tickets/ticket47653MMR_test.py
b/dirsrvtests/tickets/ticket47653MMR_test.py
index 7370332..9db2633 100644
--- a/dirsrvtests/tickets/ticket47653MMR_test.py
+++ b/dirsrvtests/tickets/ticket47653MMR_test.py
@@ -145,20 +145,10 @@ def topology(request):
master1.waitForReplInit(repl_agreement)
# Check replication is working fine
- master1.add_s(Entry((TEST_REPL_DN, {
- 'objectclass': "top person".split(),
- 'sn': 'test_repl',
- 'cn': 'test_repl'})))
- loop = 0
- ent = None
- while loop <= 10:
- try:
- ent = master2.getEntry(TEST_REPL_DN, ldap.SCOPE_BASE,
"(objectclass=*)")
- break
- except ldap.NO_SUCH_OBJECT:
- time.sleep(1)
- loop += 1
- if ent is None:
+ if master1.testReplication(DEFAULT_SUFFIX, master2):
+ log.info('Replication is working.')
+ else:
+ log.fatal('Replication is not working.')
assert False
# clear the tmp directory
diff --git a/dirsrvtests/tickets/ticket47676_test.py
b/dirsrvtests/tickets/ticket47676_test.py
index b4175ec..37d09cd 100644
--- a/dirsrvtests/tickets/ticket47676_test.py
+++ b/dirsrvtests/tickets/ticket47676_test.py
@@ -156,20 +156,10 @@ def topology(request):
master1.waitForReplInit(repl_agreement)
# Check replication is working fine
- master1.add_s(Entry((TEST_REPL_DN, {
- 'objectclass': "top person".split(),
- 'sn': 'test_repl',
- 'cn': 'test_repl'})))
- loop = 0
- ent = None
- while loop <= 10:
- try:
- ent = master2.getEntry(TEST_REPL_DN, ldap.SCOPE_BASE,
"(objectclass=*)")
- break
- except ldap.NO_SUCH_OBJECT:
- time.sleep(1)
- loop += 1
- if ent is None:
+ if master1.testReplication(DEFAULT_SUFFIX, master2):
+ log.info('Replication is working.')
+ else:
+ log.fatal('Replication is not working.')
assert False
# clear the tmp directory
diff --git a/dirsrvtests/tickets/ticket47721_test.py
b/dirsrvtests/tickets/ticket47721_test.py
index 3f1b9f2..b64d1e4 100644
--- a/dirsrvtests/tickets/ticket47721_test.py
+++ b/dirsrvtests/tickets/ticket47721_test.py
@@ -165,20 +165,10 @@ def topology(request):
master1.waitForReplInit(repl_agreement)
# Check replication is working fine
- master1.add_s(Entry((TEST_REPL_DN, {
- 'objectclass': "top person".split(),
- 'sn': 'test_repl',
- 'cn': 'test_repl'})))
- loop = 0
- ent = None
- while loop <= 10:
- try:
- ent = master2.getEntry(TEST_REPL_DN, ldap.SCOPE_BASE,
"(objectclass=*)")
- break
- except ldap.NO_SUCH_OBJECT:
- time.sleep(1)
- loop += 1
- if ent is None:
+ if master1.testReplication(DEFAULT_SUFFIX, master2):
+ log.info('Replication is working.')
+ else:
+ log.fatal('Replication is not working.')
assert False
# clear the tmp directory
diff --git a/dirsrvtests/tickets/ticket47787_test.py
b/dirsrvtests/tickets/ticket47787_test.py
index 567f85b..490e670 100644
--- a/dirsrvtests/tickets/ticket47787_test.py
+++ b/dirsrvtests/tickets/ticket47787_test.py
@@ -144,20 +144,10 @@ def topology(request):
master1.waitForReplInit(repl_agreement)
# Check replication is working fine
- master1.add_s(Entry((TEST_REPL_DN, {
- 'objectclass': "top person".split(),
- 'sn': 'test_repl',
- 'cn': 'test_repl'})))
- loop = 0
- ent = None
- while loop <= 10:
- try:
- ent = master2.getEntry(TEST_REPL_DN, ldap.SCOPE_BASE,
"(objectclass=*)")
- break
- except ldap.NO_SUCH_OBJECT:
- time.sleep(1)
- loop += 1
- if ent is None:
+ if master1.testReplication(DEFAULT_SUFFIX, master2):
+ log.info('Replication is working.')
+ else:
+ log.fatal('Replication is not working.')
assert False
# clear the tmp directory
diff --git a/dirsrvtests/tickets/ticket47869MMR_test.py
b/dirsrvtests/tickets/ticket47869MMR_test.py
index a65d5c4..1b1c5f3 100644
--- a/dirsrvtests/tickets/ticket47869MMR_test.py
+++ b/dirsrvtests/tickets/ticket47869MMR_test.py
@@ -118,19 +118,10 @@ def topology(request):
master1.waitForReplInit(repl_agreement)
# Check replication is working fine
- master1.add_s(Entry((TEST_REPL_DN, {'objectclass': "top
person".split(),
- 'sn': 'test_repl',
- 'cn': 'test_repl'})))
- loop = 0
- ent = None
- while loop <= 10:
- try:
- ent = master2.getEntry(TEST_REPL_DN, ldap.SCOPE_BASE,
"(objectclass=*)")
- break
- except ldap.NO_SUCH_OBJECT:
- time.sleep(1)
- loop += 1
- if ent is None:
+ if master1.testReplication(DEFAULT_SUFFIX, master2):
+ log.info('Replication is working.')
+ else:
+ log.fatal('Replication is not working.')
assert False
# clear the tmp directory
diff --git a/dirsrvtests/tickets/ticket47871_test.py
b/dirsrvtests/tickets/ticket47871_test.py
index 8147764..c6055c3 100644
--- a/dirsrvtests/tickets/ticket47871_test.py
+++ b/dirsrvtests/tickets/ticket47871_test.py
@@ -109,20 +109,10 @@ def topology(request):
master.waitForReplInit(repl_agreement)
# Check replication is working fine
- master.add_s(Entry((TEST_REPL_DN, {
- 'objectclass': "top person".split(),
- 'sn': 'test_repl',
- 'cn': 'test_repl'})))
- loop = 0
- ent = None
- while loop <= 10:
- try:
- ent = consumer.getEntry(TEST_REPL_DN, ldap.SCOPE_BASE,
"(objectclass=*)")
- break
- except ldap.NO_SUCH_OBJECT:
- time.sleep(1)
- loop += 1
- if ent is None:
+ if master.testReplication(DEFAULT_SUFFIX, consumer):
+ log.info('Replication is working.')
+ else:
+ log.fatal('Replication is not working.')
assert False
# clear the tmp directory
diff --git a/dirsrvtests/tickets/ticket47988_test.py
b/dirsrvtests/tickets/ticket47988_test.py
index 2541260..c51ba35 100644
--- a/dirsrvtests/tickets/ticket47988_test.py
+++ b/dirsrvtests/tickets/ticket47988_test.py
@@ -148,20 +148,10 @@ def topology(request):
master1.waitForReplInit(repl_agreement)
# Check replication is working fine
- master1.add_s(Entry((TEST_REPL_DN, {
- 'objectclass': "top person".split(),
- 'sn': 'test_repl',
- 'cn': 'test_repl'})))
- loop = 0
- ent = None
- while loop <= 10:
- try:
- ent = master2.getEntry(TEST_REPL_DN, ldap.SCOPE_BASE,
"(objectclass=*)")
- break
- except ldap.NO_SUCH_OBJECT:
- time.sleep(1)
- loop += 1
- if ent is None:
+ if master1.testReplication(DEFAULT_SUFFIX, master2):
+ log.info('Replication is working.')
+ else:
+ log.fatal('Replication is not working.')
assert False
# Here we have two instances master and consumer