From ba336aed3e41a422d9dc3830515641788c499678 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Tue, 9 Sep 2008 22:56:34 -0700 Subject: [PATCH] test_system: add deep-stats test --- src/allmydata/test/test_system.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/allmydata/test/test_system.py b/src/allmydata/test/test_system.py index 1a62d0a9..83c12c93 100644 --- a/src/allmydata/test/test_system.py +++ b/src/allmydata/test/test_system.py @@ -2084,10 +2084,35 @@ class DeepCheck(SystemTestMixin, unittest.TestCase): self.basedir = self.mktemp() d = self.set_up_nodes() d.addCallback(self.set_up_tree) + d.addCallback(self.do_stats) d.addCallback(self.do_test_good) d.addCallback(self.do_test_web) return d + def do_stats(self, ignored): + d = defer.succeed(None) + d.addCallback(lambda ign: self.root.deep_stats()) + d.addCallback(self.check_stats) + return d + + def check_stats(self, s): + self.failUnlessEqual(s["count-directories"], 1) + self.failUnlessEqual(s["count-files"], 3) + self.failUnlessEqual(s["count-immutable-files"], 1) + self.failUnlessEqual(s["count-literal-files"], 1) + self.failUnlessEqual(s["count-mutable-files"], 1) + # don't check directories: their size will vary + # s["largest-directory"] + # s["size-directories"] + self.failUnlessEqual(s["largest-directory-children"], 4) + self.failUnlessEqual(s["largest-immutable-file"], 13000) + self.failUnlessEqual(s["size-files-histogram"], + [(11, 31, 1), + (10001, 31622, 1), + ]) + self.failUnlessEqual(s["size-immutable-files"], 13000) + self.failUnlessEqual(s["size-literal-files"], 22) + def do_test_good(self, ignored): d = defer.succeed(None) # check the individual items -- 2.45.2