From 3a5a6f654c073308fa4131609b37be88303f2f10 Mon Sep 17 00:00:00 2001 From: ben Date: Sun, 18 Aug 2002 17:43:34 +0000 Subject: Added tests to find the remote destination restore and no increment restore bugs. git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@185 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109 --- rdiff-backup/testing/commontest.py | 1 + rdiff-backup/testing/finaltest.py | 10 ++++++++++ rdiff-backup/testing/restoretest.py | 7 +++++++ 3 files changed, 18 insertions(+) diff --git a/rdiff-backup/testing/commontest.py b/rdiff-backup/testing/commontest.py index dd49394..3933862 100644 --- a/rdiff-backup/testing/commontest.py +++ b/rdiff-backup/testing/commontest.py @@ -148,6 +148,7 @@ def InternalRestore(mirror_local, dest_local, mirror_dir, dest_dir, time): def get_increment_rp(mirror_rp, time): """Return increment rp matching time in seconds""" data_rp = mirror_rp.append("rdiff-backup-data") + if not data_rp.isdir(): return None for filename in data_rp.listdir(): rp = data_rp.append(filename) if rp.isincfile() and rp.getincbase_str() == "increments": diff --git a/rdiff-backup/testing/finaltest.py b/rdiff-backup/testing/finaltest.py index f1a1a51..6cd4885 100644 --- a/rdiff-backup/testing/finaltest.py +++ b/rdiff-backup/testing/finaltest.py @@ -188,6 +188,16 @@ class Final(PathSetter): self.set_connections("test1/", '../', 'test2/tmp/', '../../') self.runtest() + def testRemoteSource(self): + """Run test sequence when remote side is source""" + self.set_connections("test1/", "../", None, None) + self.runtest() + + def testRemoteDest(self): + """Run test sequence when remote side is destination""" + self.set_connections(None, None, "test2/tmp", "../../") + self.runtest() + def testMirroringLocal(self): """Run mirroring only everything remote""" self.delete_tmpdirs() diff --git a/rdiff-backup/testing/restoretest.py b/rdiff-backup/testing/restoretest.py index a5d7f12..922ca91 100644 --- a/rdiff-backup/testing/restoretest.py +++ b/rdiff-backup/testing/restoretest.py @@ -117,4 +117,11 @@ class RestoreTest(unittest.TestCase): self.assertRaises(OSError, os.lstat, "testfiles/output/tmp") self.assertRaises(OSError, os.lstat, "testfiles/output/rdiff-backup") + def testRestoreNoincs(self): + """Test restoring a directory with no increments, just mirror""" + Myrm("testfiles/output") + InternalRestore(1, 1, 'testfiles/restoretest5/regular_file', 'testfiles/output', + 10000) + assert os.lstat("testfiles/output") + if __name__ == "__main__": unittest.main() -- cgit v1.2.1