Tuesday, June 6, 2017

[389-commits] [389-ds-base] 02/02: Ticket 49281 - improve db2* tests

This is an automated email from the git hooks/post-receive script.

firstyear pushed a commit to branch master
in repository 389-ds-base.

commit 18ccdb43205cfcb91104557a4c5e3eeb058554ac
Author: William Brown <firstyear@redhat.com>
Date: Tue Jun 6 15:51:39 2017 +1000

Ticket 49281 - improve db2* tests

Bug Description: In lib389 50 we change how db2bak and db2ldif
work, so we need to update our tests accordingly

Fix Description: Add start/stop as needed, and prevent
the raw call to perl tools.

https://pagure.io/389-ds-base/issue/49281

Author: wibrown

Review by: mreynolds (Thanks!)
---
dirsrvtests/tests/suites/basic/basic_test.py | 5 +++++
dirsrvtests/tests/tickets/ticket47536_test.py | 6 ++----
dirsrvtests/tests/tickets/ticket48383_test.py | 3 ++-
3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/dirsrvtests/tests/suites/basic/basic_test.py b/dirsrvtests/tests/suites/basic/basic_test.py
index c548103..f9a954a 100644
--- a/dirsrvtests/tests/suites/basic/basic_test.py
+++ b/dirsrvtests/tests/suites/basic/basic_test.py
@@ -235,9 +235,11 @@ def test_basic_import_export(topology_st, import_example_ldif):
assert False

# Offline
+ topology_st.standalone.stop()
if not topology_st.standalone.ldif2db(DEFAULT_BENAME, None, None, None, import_ldif):
log.fatal('test_basic_import_export: Offline import failed')
assert False
+ topology_st.standalone.start()

#
# Test online and offline LDIF export
@@ -254,6 +256,7 @@ def test_basic_import_export(topology_st, import_example_ldif):
assert False

# Offline export
+ topology_st.standalone.stop()
if not topology_st.standalone.db2ldif(DEFAULT_BENAME, (DEFAULT_SUFFIX,),
None, None, None, export_ldif):
log.fatal('test_basic_import_export: Failed to run offline db2ldif')
@@ -302,6 +305,7 @@ def test_basic_backup(topology_st, import_example_ldif):
assert False

# Test offline backup
+ topology_st.standalone.stop()
if not topology_st.standalone.db2bak(backup_dir):
log.fatal('test_basic_backup: Offline backup failed')
assert False
@@ -310,6 +314,7 @@ def test_basic_backup(topology_st, import_example_ldif):
if not topology_st.standalone.bak2db(backup_dir):
log.fatal('test_basic_backup: Offline backup failed')
assert False
+ topology_st.standalone.start()

log.info('test_basic_backup: PASSED')

diff --git a/dirsrvtests/tests/tickets/ticket47536_test.py b/dirsrvtests/tests/tickets/ticket47536_test.py
index ef9817f..8847601 100644
--- a/dirsrvtests/tests/tickets/ticket47536_test.py
+++ b/dirsrvtests/tests/tickets/ticket47536_test.py
@@ -405,10 +405,8 @@ def test_ticket47536(topology_m2):
entries = topology_m2.ms["master2"].search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE, '(uid=*)')
assert 20 == len(entries)

- db2ldifpl = '%s/db2ldif.pl' % topology_m2.ms["master1"].get_sbin_dir()
- cmdline = [db2ldifpl, '-n', 'userRoot', '-Z', SERVERID_MASTER_1, '-D', DN_DM, '-w', PASSWORD]
- log.info("##### db2ldif.pl -- %s" % (cmdline))
- doAndPrintIt(cmdline)
+ output_file = os.path.join(topology_m2.ms["master1"].get_ldif_dir(), "master1.ldif")
+ topology_m2.ms["master1"].tasks.exportLDIF(benamebase='userRoot', output_file=output_file, args={'wait': True})

log.info("Ticket 47536 - PASSED")

diff --git a/dirsrvtests/tests/tickets/ticket48383_test.py b/dirsrvtests/tests/tickets/ticket48383_test.py
index b1fa93d..a147448 100644
--- a/dirsrvtests/tests/tickets/ticket48383_test.py
+++ b/dirsrvtests/tests/tickets/ticket48383_test.py
@@ -69,7 +69,7 @@ def test_ticket48383(topology_st):
ldifpath = os.path.join(topology_st.standalone.get_ldif_dir(), "%s.ldif" % SERVERID_STANDALONE)

# stop the server
- topology_st.standalone.stop(timeout=30)
+ topology_st.standalone.stop()
# Now export and import the DB. It's easier than db2index ...
topology_st.standalone.db2ldif(bename=DEFAULT_BENAME, suffixes=[DEFAULT_SUFFIX], excludeSuffixes=[],
encrypt=False, repl_data=True, outputfile=ldifpath)
@@ -77,6 +77,7 @@ def test_ticket48383(topology_st):
result = topology_st.standalone.ldif2db(DEFAULT_BENAME, None, None, False, ldifpath)

assert (result)
+ topology_st.standalone.start()

# see if user1 exists at all ....


--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
389-commits mailing list -- 389-commits@lists.fedoraproject.org
To unsubscribe send an email to 389-commits-leave@lists.fedoraproject.org

No comments:

Post a Comment