Monday, June 13, 2016

[389-commits] dirsrvtests/tests

dirsrvtests/tests/tickets/ticket47536_test.py | 8 ++++----
dirsrvtests/tests/tickets/ticket48013_test.py | 11 ++++++++++-
dirsrvtests/tests/tickets/ticket48194_test.py | 8 ++++----
dirsrvtests/tests/tickets/ticket48212_test.py | 24 +++++-------------------
dirsrvtests/tests/tickets/ticket48228_test.py | 24 ++++++++++++------------
dirsrvtests/tests/tickets/ticket48383_test.py | 11 +++++++----
dirsrvtests/tests/tickets/ticket48665_test.py | 8 ++++++--
7 files changed, 48 insertions(+), 46 deletions(-)

New commits:
commit 735ccc6d2929143e4ae7fce9c0c07f0a0cedd3a5
Author: Simon Pichugin <spichugi@redhat.com>
Date: Tue May 24 11:03:55 2016 +0200

Ticket 48832 - CI test - fix ticket failures

Description:
ticket47536_test.py
- Get prefix from variable, not from env

ticket48013_test.py
- Change hardcoded host:port to variables

ticket48194_test.py
- Change security port to 636 to avoid SElinux denial

ticket48212_test.py
- Increase sleeping time and change the checks to smart assertion

ticket48383_test.py
ticket48665_test.py
- Change test case to use simple ldap modify operation for setting
backend property

ticket48228_test.py
- Refactor assertions and add time.sleep(1) between operations

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

Review by: nhosoi (Thanks!)

diff --git a/dirsrvtests/tests/tickets/ticket47536_test.py b/dirsrvtests/tests/tickets/ticket47536_test.py
index 1712e7c..1bcbb14 100644
--- a/dirsrvtests/tests/tickets/ticket47536_test.py
+++ b/dirsrvtests/tests/tickets/ticket47536_test.py
@@ -25,7 +25,7 @@ from lib389.utils import *
logging.getLogger(__name__).setLevel(logging.DEBUG)
log = logging.getLogger(__name__)

-installation1_prefix = None
+installation1_prefix = ''

CONFIG_DN = 'cn=config'
ENCRYPTION_DN = 'cn=encryption,%s' % CONFIG_DN
@@ -70,7 +70,7 @@ def topology(request):
master1.replica.enableReplication(suffix=SUFFIX, role=REPLICAROLE_MASTER, replicaId=REPLICAID_MASTER_1)

# Creating master 2...
- master2 = DirSrv(verbose=True)
+ master2 = DirSrv(verbose=False)
if installation1_prefix:
args_instance[SER_DEPLOYED_DIR] = installation1_prefix
args_instance[SER_HOST] = HOST_MASTER_2
@@ -489,7 +489,7 @@ def test_ticket47536(topology):
add_entry(topology.master2, 'master2', 'uid=m2user', 0, 5)

time.sleep(1)
-
+
log.info('##### Searching for entries on master1...')
entries = topology.master1.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE, '(uid=*)')
assert 10 == len(entries)
@@ -513,7 +513,7 @@ def test_ticket47536(topology):
entries = topology.master2.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE, '(uid=*)')
assert 20 == len(entries)

- db2ldifpl = '%s/sbin/db2ldif.pl' % os.getenv('PREFIX')
+ db2ldifpl = '%s/sbin/db2ldif.pl' % installation1_prefix
cmdline = [db2ldifpl, '-n', 'userRoot', '-Z', SERVERID_MASTER_1, '-D', DN_DM, '-w', PASSWORD]
log.info("##### db2ldif.pl -- %s" % (cmdline))
doAndPrintIt(cmdline)
diff --git a/dirsrvtests/tests/tickets/ticket48013_test.py b/dirsrvtests/tests/tickets/ticket48013_test.py
index 0ccdeba..730f929 100644
--- a/dirsrvtests/tests/tickets/ticket48013_test.py
+++ b/dirsrvtests/tests/tickets/ticket48013_test.py
@@ -1,3 +1,11 @@
+# --- BEGIN COPYRIGHT BLOCK ---
+# Copyright (C) 2016 Red Hat, Inc.
+# All rights reserved.
+#
+# License: GPL (version 3 or any later version).
+# See LICENSE for details.
+# --- END COPYRIGHT BLOCK ---
+#
import os
import sys
import time
@@ -89,7 +97,8 @@ def test_ticket48013(topology):
topology.standalone.plugins.enable(name=PLUGIN_REPL_SYNC)

# Set everything up
- ldap_url = ldapurl.LDAPUrl('ldap://localhost:31389')
+ ldap_url = ldapurl.LDAPUrl('ldap://%s:%s' % (HOST_STANDALONE,
+ PORT_STANDALONE))
ldap_connection = SyncObject(ldap_url.initializeUrl())

# Authenticate
diff --git a/dirsrvtests/tests/tickets/ticket48194_test.py b/dirsrvtests/tests/tickets/ticket48194_test.py
index f69d013..fa4fe72 100644
--- a/dirsrvtests/tests/tickets/ticket48194_test.py
+++ b/dirsrvtests/tests/tickets/ticket48194_test.py
@@ -1,9 +1,9 @@
# --- BEGIN COPYRIGHT BLOCK ---
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2016 Red Hat, Inc.
# All rights reserved.
#
# License: GPL (version 3 or any later version).
-# See LICENSE for details.
+# See LICENSE for details.
# --- END COPYRIGHT BLOCK ---
#
import os
@@ -26,7 +26,7 @@ CONFIG_DN = 'cn=config'
ENCRYPTION_DN = 'cn=encryption,%s' % CONFIG_DN
RSA = 'RSA'
RSA_DN = 'cn=%s,%s' % (RSA, ENCRYPTION_DN)
-LDAPSPORT = '10636'
+LDAPSPORT = '636'
SERVERCERT = 'Server-Cert'
plus_all_ecount = 0
plus_all_dcount = 0
@@ -326,7 +326,7 @@ def my_test_run_5(topology):

def my_test_run_6(topology):
"""
- Check nsSSL3Ciphers: +all,-TLS_RSA_WITH_AES_256_CBC_SHA256
+ Check nsSSL3Ciphers: +all,-TLS_RSA_WITH_AES_256_CBC_SHA256
All ciphers are disabled.
default allowWeakCipher
"""
diff --git a/dirsrvtests/tests/tickets/ticket48212_test.py b/dirsrvtests/tests/tickets/ticket48212_test.py
index 4da6939..82ec102 100644
--- a/dirsrvtests/tests/tickets/ticket48212_test.py
+++ b/dirsrvtests/tests/tickets/ticket48212_test.py
@@ -82,7 +82,7 @@ def runDbVerify(topology):
assert False
else:
topology.standalone.log.info("dbverify passed")
-
+
def reindexUidNumber(topology):
topology.standalone.log.info("\n\n +++++ reindex uidnumber +++++\n")
sbin_dir = get_sbin_dir(prefix=topology.standalone.prefix)
@@ -91,27 +91,13 @@ def reindexUidNumber(topology):
indexOUT = os.popen(indexCMD, "r")
topology.standalone.log.info("Running %s" % indexCMD)

- time.sleep(10)
+ time.sleep(15)

tailCMD = "tail -n 3 " + topology.standalone.errlog
tailOUT = os.popen(tailCMD, "r")
- running = True
- done = False
- while running:
- l = tailOUT.readline()
- if l == "":
- running = False
- elif "Finished indexing" in l:
- running = False
- done = True
- topology.standalone.log.info("%s" % l)
-
- if done:
- topology.standalone.log.info("%s done" % indexCMD)
- else:
- topology.standalone.log.fatal("%s did not finish" % indexCMD)
- assert False
-
+ assert 'Finished indexing' in tailOUT.read()
+
+
def test_ticket48212(topology):
"""
Import posixAccount entries.
diff --git a/dirsrvtests/tests/tickets/ticket48228_test.py b/dirsrvtests/tests/tickets/ticket48228_test.py
index bb20620..f3657c4 100644
--- a/dirsrvtests/tests/tickets/ticket48228_test.py
+++ b/dirsrvtests/tests/tickets/ticket48228_test.py
@@ -162,22 +162,22 @@ def check_passwd_inhistory(topology, user, cpw, passwd):
except ldap.LDAPError as e:
log.info(' The password ' + passwd + ' of user' + USER1_DN + ' in history: error ' + e.message['desc'])
inhistory = 1
+ time.sleep(1)
return inhistory


def update_passwd(topology, user, passwd, times):
cpw = passwd
- loop = 0
- while loop < times:
+ for i in range(times):
log.info(" Bind as {%s,%s}" % (user, cpw))
topology.standalone.simple_bind_s(user, cpw)
- cpw = 'password%d' % loop
+ cpw = 'password%d' % i
try:
topology.standalone.modify_s(user, [(ldap.MOD_REPLACE, 'userpassword', cpw)])
except ldap.LDAPError as e:
log.fatal('test_ticket48228: Failed to update the password ' + cpw + ' of user ' + user + ': error ' + e.message['desc'])
assert False
- loop += 1
+ time.sleep(1)

# checking the first password, which is supposed to be in history
inhistory = check_passwd_inhistory(topology, user, cpw, passwd)
@@ -227,15 +227,15 @@ def test_ticket48228_test_global_policy(topology):
inhistory = check_passwd_inhistory(topology, USER1_DN, cpw, tpw)
assert inhistory == 0

- log.info(' checking the second password, which is supposed NOT to be in history any more')
+ log.info(' checking the third password, which is supposed NOT to be in history any more')
cpw = tpw
tpw = 'password%d' % 1
inhistory = check_passwd_inhistory(topology, USER1_DN, cpw, tpw)
assert inhistory == 0

- log.info(' checking the third password, which is supposed to be in history')
+ log.info(' checking the sixth password, which is supposed to be in history')
cpw = tpw
- tpw = 'password%d' % 2
+ tpw = 'password%d' % 5
inhistory = check_passwd_inhistory(topology, USER1_DN, cpw, tpw)
assert inhistory == 1

@@ -286,19 +286,19 @@ def test_ticket48228_test_subtree_policy(topology):

log.info(' checking the second password, which is supposed NOT to be in history any more')
cpw = tpw
- tpw = 'password%d' % 0
+ tpw = 'password%d' % 1
inhistory = check_passwd_inhistory(topology, USER2_DN, cpw, tpw)
assert inhistory == 0

- log.info(' checking the second password, which is supposed NOT to be in history any more')
+ log.info(' checking the third password, which is supposed NOT to be in history any more')
cpw = tpw
- tpw = 'password%d' % 1
+ tpw = 'password%d' % 2
inhistory = check_passwd_inhistory(topology, USER2_DN, cpw, tpw)
assert inhistory == 0

- log.info(' checking the third password, which is supposed to be in history')
+ log.info(' checking the six password, which is supposed to be in history')
cpw = tpw
- tpw = 'password%d' % 2
+ tpw = 'password%d' % 5
inhistory = check_passwd_inhistory(topology, USER2_DN, cpw, tpw)
assert inhistory == 1

diff --git a/dirsrvtests/tests/tickets/ticket48383_test.py b/dirsrvtests/tests/tickets/ticket48383_test.py
index fc11cee..d05c7c2 100644
--- a/dirsrvtests/tests/tickets/ticket48383_test.py
+++ b/dirsrvtests/tests/tickets/ticket48383_test.py
@@ -26,7 +26,7 @@ class TopologyStandalone(object):
@pytest.fixture(scope="module")
def topology(request):
# Creating standalone instance ...
- standalone = DirSrv(verbose=True)
+ standalone = DirSrv(verbose=False)
args_instance[SER_HOST] = HOST_STANDALONE
args_instance[SER_PORT] = PORT_STANDALONE
args_instance[SER_SERVERID_PROP] = SERVERID_STANDALONE
@@ -98,10 +98,13 @@ def test_ticket48383(topology):
except ldap.LDAPError as e:
log.fatal('test 48383: Failed to user%s: error %s ' % (i, e.message['desc']))
assert False
- # Set the dbsize really low.

- topology.standalone.backend.setProperties(bename=DEFAULT_BENAME,
- prop='nsslapd-cachememsize', values='1')
+ # Set the dbsize really low.
+ try:
+ topology.standalone.modify_s(DEFAULT_BENAME, [(ldap.MOD_REPLACE,
+ 'nsslapd-cachememsize', '1')])
+ except ldap.LDAPError as e:
+ log.fatal('Failed to change nsslapd-cachememsize ' + e.message['desc'])

## Does ds try and set a minimum possible value for this?
## Yes: [16/Feb/2016:16:39:18 +1000] - WARNING: cache too small, increasing to 500K bytes
diff --git a/dirsrvtests/tests/tickets/ticket48665_test.py b/dirsrvtests/tests/tickets/ticket48665_test.py
index 702319c..9396b8a 100644
--- a/dirsrvtests/tests/tickets/ticket48665_test.py
+++ b/dirsrvtests/tests/tickets/ticket48665_test.py
@@ -76,8 +76,12 @@ def test_ticket48665(topology):
assert(DN_DM.lower() in result.lower())

# This has a magic hack to determine if we are in cn=config.
- topology.standalone.backend.setProperties(bename=DEFAULT_BENAME,
- prop='nsslapd-cachememsize', values='1')
+ try:
+ topology.standalone.modify_s(DEFAULT_BENAME, [(ldap.MOD_REPLACE,
+ 'nsslapd-cachememsize', '1')])
+ except ldap.LDAPError as e:
+ log.fatal('Failed to change nsslapd-cachememsize ' + e.message['desc'])
+
# Check the server has not commited seppuku.
result = topology.standalone.whoami_s()
assert(DN_DM.lower() in result.lower())

--
389-commits mailing list
389-commits@lists.fedoraproject.org
https://lists.fedoraproject.org/admin/lists/389-commits@lists.fedoraproject.org

No comments:

Post a Comment