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):