From b1919bd79429c8b66ea8be8b62df8491ab01254b Mon Sep 17 00:00:00 2001 From: Mohammed Junaid Date: Mon, 22 Jul 2013 10:38:26 +0530 Subject: Gracefully handle the ring file not found error. Change-Id: I35c33f3938709d5d9a9a55640a503f186df9a965 Signed-off-by: Mohammed Junaid Reviewed-on: http://review.gluster.org/5368 Reviewed-by: Luis Pabon Tested-by: Luis Pabon --- test/unit/common/test_ring.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/unit') diff --git a/test/unit/common/test_ring.py b/test/unit/common/test_ring.py index ca9fc5c..32dd7bb 100644 --- a/test/unit/common/test_ring.py +++ b/test/unit/common/test_ring.py @@ -14,6 +14,7 @@ # limitations under the License. import os +import errno import unittest import gluster.swift.common.constraints import swift.common.utils @@ -66,3 +67,15 @@ class TestRing(unittest.TestCase): def test_invalid_partition(self): nodes = self.ring.get_part_nodes(0) self.assertEqual(nodes[0]['device'], 'volume_not_in_ring') + + def test_ring_file_enoent(self): + swiftdir = os.path.join(os.getcwd(), "common", "data") + try: + self.ring = Ring(swiftdir, ring_name='obj') + except OSError as ose: + if ose.errno == errno.ENOENT: + pass + else: + self.fail('ENOENT expected, %s received.' %ose.errno) + else: + self.fail('OSError expected.') -- cgit