From da3cdf9df0177e72f0b89246eff7e17ff58e4477 Mon Sep 17 00:00:00 2001 From: bescoto Date: Thu, 24 Nov 2005 05:07:09 +0000 Subject: Remove older than overenthusiastic deletion fix git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/branches/r1-0@689 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109 --- rdiff-backup/testing/finaltest.py | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'rdiff-backup/testing/finaltest.py') diff --git a/rdiff-backup/testing/finaltest.py b/rdiff-backup/testing/finaltest.py index 65f38e5..8acfee6 100644 --- a/rdiff-backup/testing/finaltest.py +++ b/rdiff-backup/testing/finaltest.py @@ -425,13 +425,34 @@ class FinalMisc(PathSetter): for inc in self.get_all_increments(rbdir): assert inc.getinctime() >= 30000 + def testRemoveOlderThanCurrent(self): + """Make sure --remove-older-than doesn't delete current incs""" + Myrm("testfiles/output") + assert not os.system('cp -a testfiles/restoretest3 testfiles/output') + self.set_connections(None, None, None, None) + self.exec_rb_extra_args(None, '--remove-older-than now --force', + 'testfiles/output') + rbdir = rpath.RPath(Globals.local_connection, + "testfiles/output/rdiff-backup-data") + + has_cur_mirror, has_metadata = 0, 0 + for inc in self.get_all_increments(rbdir): + if inc.getincbase().index[-1] == 'current_mirror': + has_cur_mirror = 1 + elif inc.getincbase().index[-1] == 'mirror_metadata': + has_metadata = 1 + assert has_cur_mirror and has_metadata, (has_cur_mirror, has_metadata) + def testRemoveOlderThanQuoting(self): """Test --remove-older-than when dest directory is quoted""" Myrm("testfiles/output") self.set_connections(None, None, None, None) - self.exec_rb_extra_args(None, "--override-chars-to-quote '^a-z0-9_ -.'", - "testfiles/increment1", "testfiles/output") - self.exec_rb_extra_args(None, "--remove-older-than now", "testfiles/output") + self.exec_rb_extra_args(None, "--override-chars-to-quote '^a-z0-9_ -.'" + " --current-time 10000", "testfiles/increment1", "testfiles/output") + self.exec_rb_extra_args(None, "--override-chars-to-quote '^a-z0-9_ -.'" + " --current-time 20000", "testfiles/increment2", "testfiles/output") + self.exec_rb_extra_args(None, "--remove-older-than now", + "testfiles/output") def testRemoveOlderThanRemote(self): """Test --remove-older-than remotely""" -- cgit v1.2.1