diff options
author | bescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2003-08-24 03:39:56 +0000 |
---|---|---|
committer | bescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2003-08-24 03:39:56 +0000 |
commit | 6a48fc6c34e3d2f8fcaf791a847aebb6854557e7 (patch) | |
tree | dfd7331259298750b49f7493ba52219acd647164 /rdiff-backup/testing | |
parent | 94da66c4015094e2c5a71e945ef3562644543c0f (diff) | |
download | rdiff-backup-6a48fc6c34e3d2f8fcaf791a847aebb6854557e7.tar.gz |
When data gets deleted from dest, try not to exit as easily
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@401 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
Diffstat (limited to 'rdiff-backup/testing')
-rw-r--r-- | rdiff-backup/testing/finaltest.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/rdiff-backup/testing/finaltest.py b/rdiff-backup/testing/finaltest.py index 593570f..4f1caf9 100644 --- a/rdiff-backup/testing/finaltest.py +++ b/rdiff-backup/testing/finaltest.py @@ -471,5 +471,50 @@ testfiles/increment2/changed_dir""") self.assertRaises(OSError, os.lstat, 'testfiles/restoretarget1/executable2') + +class FinalCorrupt(PathSetter): + """Test messing with things a bit and making sure they still work""" + def make_dir(self): + self.delete_tmpdirs() + rp1 = rpath.RPath(Globals.local_connection, 'testfiles/final_deleted1') + if rp1.lstat(): Myrm(rp1.path) + rp1.mkdir() + rp1_1 = rp1.append('regfile') + rp1_1.touch() + rp1_2 = rp1.append('dir') + rp1_2.mkdir() + rp1_2_1 = rp1_2.append('regfile2') + rp1_2_1.write_string('foo') + + rp2 = rpath.RPath(Globals.local_connection, 'testfiles/final_deleted2') + if rp2.lstat(): Myrm(rp2.path) + os.system('cp -a %s %s' % (rp1.path, rp2.path)) + rp2_2_1 = rp2.append('dir').append('regfile2') + assert rp2_2_1.lstat() + rp2_2_1.delete() + rp2_2_1.touch() + return rp1, rp1_2, rp2 + + def test_dest_delete(self): + """Test deleting a directory from the destination dir + + Obviously that directory can no longer be restored, but the + rest of the files should be OK. Just runs locally for now. + + """ + in_dir1, in_subdir, in_dir2 = self.make_dir() + self.set_connections(None, None, None, None) + self.exec_rb(10000, in_dir1.path, 'testfiles/output') + + out_subdir = rpath.RPath(Globals.local_connection, + 'testfiles/output/%s' % + (in_subdir.index[-1],)) + log.Log("Deleting %s" % (out_subdir.path,), 3) + out_subdir.delete() + self.exec_rb(20000, in_dir2.path, 'testfiles/output') + + self.exec_rb_restore(10000, 'testfiles/output', + 'testfiles/restoretarget1') + if __name__ == "__main__": unittest.main() |