]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
cli: add tests for 'tahoe stats --verbose'
authorBrian Warner <warner@allmydata.com>
Tue, 18 Nov 2008 05:11:14 +0000 (22:11 -0700)
committerBrian Warner <warner@allmydata.com>
Tue, 18 Nov 2008 05:11:14 +0000 (22:11 -0700)
src/allmydata/scripts/tahoe_manifest.py
src/allmydata/test/test_system.py

index 378ad36947be0b65c7297ee0f1983299642ea259..ae3a4b2bff97b8b6b6c04735c9679078efd0c312 100644 (file)
@@ -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
index 07cf9323c44448e8628cc8eb00ebae028a6294f2..baa06b186a41c0a2822f781b87bd5d4920a181e6 100644 (file)
@@ -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