From ead0e4d6cafebb15dd2c27a97e04fb4dd63dfbc8 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Mon, 17 Nov 2008 22:11:14 -0700 Subject: [PATCH] cli: add tests for 'tahoe stats --verbose' --- src/allmydata/scripts/tahoe_manifest.py | 2 +- src/allmydata/test/test_system.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) 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 -- 2.45.2