Merge "Make test_ringbuilder less brittle"
This commit is contained in:
commit
84a8465fc1
@ -1925,14 +1925,18 @@ class TestCommands(unittest.TestCase, RunSwiftRingBuilderMixin):
|
|||||||
mock_stdout = six.StringIO()
|
mock_stdout = six.StringIO()
|
||||||
mock_stderr = six.StringIO()
|
mock_stderr = six.StringIO()
|
||||||
|
|
||||||
argv = ["", "object.ring.gz"]
|
argv = ["", self.tmpfile, "rebalance", "3"],
|
||||||
|
self.assertSystemExit(EXIT_SUCCESS, ringbuilder.main, argv)
|
||||||
|
|
||||||
|
argv = ["", "%s.ring.gz" % self.tmpfile]
|
||||||
|
|
||||||
with mock.patch("sys.stdout", mock_stdout):
|
with mock.patch("sys.stdout", mock_stdout):
|
||||||
with mock.patch("sys.stderr", mock_stderr):
|
with mock.patch("sys.stderr", mock_stderr):
|
||||||
self.assertSystemExit(EXIT_ERROR, ringbuilder.main, argv)
|
self.assertSystemExit(EXIT_ERROR, ringbuilder.main, argv)
|
||||||
expected = "Note: using object.builder instead of object.ring.gz " \
|
expected = "Note: using %s.builder instead of %s.ring.gz " \
|
||||||
"as builder file\n" \
|
"as builder file\n" \
|
||||||
"Ring Builder file does not exist: object.builder\n"
|
"Ring Builder file does not exist: %s.builder\n" % (
|
||||||
|
self.tmpfile, self.tmpfile, self.tmpfile)
|
||||||
self.assertEqual(expected, mock_stdout.getvalue())
|
self.assertEqual(expected, mock_stdout.getvalue())
|
||||||
|
|
||||||
def test_main_no_arguments(self):
|
def test_main_no_arguments(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user