From 8f964fb6e8a9707065d033b2586c3335498593cd Mon Sep 17 00:00:00 2001
From: William Brown <firstyear@redhat.com>
Date: Tue, 21 Nov 2017 16:51:13 +0100
Subject: [PATCH] Ticket 49298 - issue with test case and remove-ds.pl

Bug Description:  In some cases, the missing dse.ldif would
cause remove ds.pl to fail.

Fix Description:  Move and restore the dse.ldif instead to allow
the test to pass.

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

Author: wibrown

Review by: ???
---
 dirsrvtests/tests/suites/config/removed_config_49298_test.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/dirsrvtests/tests/suites/config/removed_config_49298_test.py b/dirsrvtests/tests/suites/config/removed_config_49298_test.py
index e652369..7cf0f20 100644
--- a/dirsrvtests/tests/suites/config/removed_config_49298_test.py
+++ b/dirsrvtests/tests/suites/config/removed_config_49298_test.py
@@ -42,7 +42,8 @@ def test_restore_config(topo):
 
     for i in ('dse.ldif', 'dse.ldif.startOK'):
         p = os.path.join(dse_path, i)
-        os.remove(p)
+        d = os.path.join(dse_path, i + '.49298')
+        os.rename(p, d)
 
     # This will pass.
     topo.standalone.start()
@@ -70,7 +71,8 @@ def test_removed_config(topo):
 
     for i in ('dse.ldif', 'dse.ldif.bak', 'dse.ldif.startOK'):
         p = os.path.join(dse_path, i)
-        os.remove(p)
+        d = os.path.join(dse_path, i + '.49298')
+        os.rename(p, d)
 
     # We actually can't check the log output, because it can't read dse.ldif,
     # don't know where to write it yet! All we want is the server fail to
@@ -78,4 +80,9 @@ def test_removed_config(topo):
     with pytest.raises(subprocess.CalledProcessError):
         topo.standalone.start()
 
+    # Restore the files so that setup-ds.l can work
+    for i in ('dse.ldif', 'dse.ldif.bak', 'dse.ldif.startOK'):
+        p = os.path.join(dse_path, i)
+        d = os.path.join(dse_path, i + '.49298')
+        os.rename(d, p)
 
-- 
1.8.3.1

