From 71504699a28c2062b6b8527864ad28bdc8eb6e3b Mon Sep 17 00:00:00 2001 From: Mark Berger <mark.berger.j@gmail.com> Date: Mon, 13 May 2013 22:45:46 -0700 Subject: [PATCH] Added test_check_with_multiple_aliases in test_cli --- src/allmydata/test/test_cli.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) 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): -- 2.45.2