diff options
author | ben <ben@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2002-05-25 18:54:30 +0000 |
---|---|---|
committer | ben <ben@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2002-05-25 18:54:30 +0000 |
commit | 7a82871f7b6d25464516dd659f3e98cc56211ff1 (patch) | |
tree | f0f6c1d0b040769c759e76eeee355776dd453eb8 /rdiff-backup/testing/incrementtest.py | |
parent | 9b6416eaf5e1691d2e640a5da2a14b4efac38348 (diff) | |
download | rdiff-backup-7a82871f7b6d25464516dd659f3e98cc56211ff1.tar.gz |
Bugfixed the new statistics stuff
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@108 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
Diffstat (limited to 'rdiff-backup/testing/incrementtest.py')
-rw-r--r-- | rdiff-backup/testing/incrementtest.py | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/rdiff-backup/testing/incrementtest.py b/rdiff-backup/testing/incrementtest.py index 5df1749..8c75ff7 100644 --- a/rdiff-backup/testing/incrementtest.py +++ b/rdiff-backup/testing/incrementtest.py @@ -164,6 +164,23 @@ class inctest(unittest.TestCase): class inctest2(unittest.TestCase): """Like inctest but contains more elaborate tests""" + def stats_check_initial(self, s): + """Make sure stats object s compatible with initial mirroring + + A lot of the off by one stuff is because the root directory + exists in the below examples. + + """ + assert s.MirrorFiles == 1 or s.MirrorFiles == 0 + assert s.MirrorFileSize < 20000 + assert s.NewFiles <= s.SourceFiles <= s.NewFiles + 1 + assert s.NewFileSize <= s.SourceFileSize <= s.NewFileSize + 20000 + assert s.ChangedFiles == 1 or s.ChangedFiles == 0 + assert s.ChangedSourceSize < 20000 + assert s.ChangedMirrorSize < 20000 + assert s.DeletedFiles == s.DeletedFileSize == 0 + assert s.IncrementFileSize == 0 + def testStatistics(self): """Test the writing of statistics @@ -181,8 +198,13 @@ class inctest2(unittest.TestCase): incs = Restore.get_inclist(inc_base.append("subdir"). append("directory_statistics")) - assert len(incs) == 1 - subdir_stats = StatsObj().read_stats_from_rp(incs[0]) + assert len(incs) == 2 + s1 = StatsObj().read_stats_from_rp(incs[0]) # initial mirror stats + assert s1.SourceFiles == 2 + assert 400000 < s1.SourceFileSize < 420000 + self.stats_check_initial(s1) + + subdir_stats = StatsObj().read_stats_from_rp(incs[1]) # increment stats assert subdir_stats.SourceFiles == 2 assert 400000 < subdir_stats.SourceFileSize < 420000 assert subdir_stats.MirrorFiles == 2 @@ -195,8 +217,13 @@ class inctest2(unittest.TestCase): assert 10 < subdir_stats.IncrementFileSize < 20000 incs = Restore.get_inclist(inc_base.append("directory_statistics")) - assert len(incs) == 1 - root_stats = StatsObj().read_stats_from_rp(incs[0]) + assert len(incs) == 2 + s2 = StatsObj().read_stats_from_rp(incs[0]) + assert s2.SourceFiles == 7 + assert 700000 < s2.SourceFileSize < 750000 + self.stats_check_initial(s2) + + root_stats = StatsObj().read_stats_from_rp(incs[1]) assert root_stats.SourceFiles == 7 assert 550000 < root_stats.SourceFileSize < 570000 assert root_stats.MirrorFiles == 7 @@ -208,6 +235,6 @@ class inctest2(unittest.TestCase): assert 3 <= root_stats.ChangedFiles <= 4, root_stats.ChangedFiles assert 450000 < root_stats.ChangedSourceSize < 470000 assert 400000 < root_stats.ChangedMirrorSize < 420000 - assert 10 < subdir_stats.IncrementtFileSize < 30000 + assert 10 < subdir_stats.IncrementFileSize < 30000 if __name__ == '__main__': unittest.main() |