]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Added test_check_with_multiple_aliases in test_cli 48/head
authorMark Berger <mark.berger.j@gmail.com>
Tue, 14 May 2013 05:45:46 +0000 (22:45 -0700)
committerMark Berger <mark.berger.j@gmail.com>
Fri, 26 Jul 2013 17:01:51 +0000 (13:01 -0400)
src/allmydata/test/test_cli.py

index 2fd6fedcfa23d58764d86142cc7c054ff7a2feae..5e7d56ab4a47d66025a89fe0b5361b1992b48277 100644 (file)
@@ -3298,6 +3298,37 @@ class Check(GridTestMixin, CLITestMixin, unittest.TestCase):
         d.addCallback(_check)
         return d
 
+    def test_check_with_multiple_aliases(self):
+        self.basedir = "cli/Check/check_with_multiple_aliases"
+        self.set_up_grid()
+        self.uriList = []
+        c0 = self.g.clients[0]
+        d = c0.create_dirnode()
+        def _stash_uri(n):
+            self.uriList.append(n.get_uri()) 
+        d.addCallback(_stash_uri)
+        d = c0.create_dirnode()
+        d.addCallback(_stash_uri)
+        
+        d.addCallback(lambda ign: self.do_cli("check", self.uriList[0], self.uriList[1]))
+        def _check((rc, out, err)):
+            self.failUnlessReallyEqual(rc, 0)
+            self.failUnlessReallyEqual(err, "")
+            #Ensure healthy appears for each uri
+            self.failUnlessIn("Healthy", out[:len(out)/2])
+            self.failUnlessIn("Healthy", out[len(out)/2:])
+        d.addCallback(_check)
+        
+        d.addCallback(lambda ign: self.do_cli("check", self.uriList[0], "nonexistent:"))
+        def _check2((rc, out, err)):
+            self.failUnlessReallyEqual(rc, 1)
+            self.failUnlessIn("Healthy", out)
+            self.failUnlessIn("error:", err)
+            self.failUnlessIn("nonexistent", err)
+        d.addCallback(_check2)
+        
+        return d
+
 
 class Errors(GridTestMixin, CLITestMixin, unittest.TestCase):
     def test_get(self):