From: Mark Berger Date: Tue, 14 May 2013 05:45:46 +0000 (-0700) Subject: Added test_check_with_multiple_aliases in test_cli X-Git-Tag: allmydata-tahoe-1.10.1a1~222^2 X-Git-Url: https://git.rkrishnan.org/webform_css?a=commitdiff_plain;h=refs%2Fpull%2F48%2Fhead;p=tahoe-lafs%2Ftahoe-lafs.git Added test_check_with_multiple_aliases in test_cli --- diff --git a/src/allmydata/test/test_cli.py b/src/allmydata/test/test_cli.py index 2fd6fedc..5e7d56ab 100644 --- a/src/allmydata/test/test_cli.py +++ b/src/allmydata/test/test_cli.py @@ -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):