From: Brian Warner Date: Tue, 18 Nov 2008 05:11:14 +0000 (-0700) Subject: cli: add tests for 'tahoe stats --verbose' X-Git-Tag: allmydata-tahoe-1.3.0~418 X-Git-Url: https://git.rkrishnan.org/pf/content//%22%3C?a=commitdiff_plain;h=ead0e4d6cafebb15dd2c27a97e04fb4dd63dfbc8;p=tahoe-lafs%2Ftahoe-lafs.git cli: add tests for 'tahoe stats --verbose' --- diff --git a/src/allmydata/scripts/tahoe_manifest.py b/src/allmydata/scripts/tahoe_manifest.py index 378ad369..ae3a4b2b 100644 --- a/src/allmydata/scripts/tahoe_manifest.py +++ b/src/allmydata/scripts/tahoe_manifest.py @@ -68,7 +68,7 @@ class SlowOperationRunner: if not data["finished"]: return False if self.options.get("verbose"): - print jdata + print >>stdout, jdata return True self.write_results(data) return True diff --git a/src/allmydata/test/test_system.py b/src/allmydata/test/test_system.py index 07cf9323..baa06b18 100644 --- a/src/allmydata/test/test_system.py +++ b/src/allmydata/test/test_system.py @@ -2440,6 +2440,25 @@ class DeepCheckWebGood(DeepCheckBase, unittest.TestCase): self.failUnless("10001-31622 : 1".strip() in lines) d.addCallback(_check3) + d.addCallback(lambda res: + self._run_cli(["stats", + "--node-directory", basedir, + "--verbose", + self.root_uri])) + def _check4((out,err)): + data = simplejson.loads(out) + self.failUnlessEqual(data["count-immutable-files"], 1) + self.failUnlessEqual(data["count-immutable-files"], 1) + self.failUnlessEqual(data["count-mutable-files"], 1) + self.failUnlessEqual(data["count-literal-files"], 2) + self.failUnlessEqual(data["count-files"], 4) + self.failUnlessEqual(data["count-directories"], 1) + self.failUnlessEqual(data["size-immutable-files"], 13000) + self.failUnlessEqual(data["size-literal-files"], 48) + self.failUnless([11,31,2] in data["size-files-histogram"]) + self.failUnless([10001,31622,1] in data["size-files-histogram"]) + d.addCallback(_check4) + return d