summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorMohammed Junaid <junaid@redhat.com>2013-07-22 10:38:26 +0530
committerLuis Pabon <lpabon@redhat.com>2013-07-24 18:41:54 -0700
commitb1919bd79429c8b66ea8be8b62df8491ab01254b (patch)
tree09604be60c03852a36cb235721132cd9dc302a08 /test/unit
parent7ef1581a074757b05fc8f3235a558d10e990dce4 (diff)
Gracefully handle the ring file not found error.
Change-Id: I35c33f3938709d5d9a9a55640a503f186df9a965 Signed-off-by: Mohammed Junaid <junaid@redhat.com> Reviewed-on: http://review.gluster.org/5368 Reviewed-by: Luis Pabon <lpabon@redhat.com> Tested-by: Luis Pabon <lpabon@redhat.com>
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/common/test_ring.py13
1 files changed, 13 insertions, 0 deletions
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.')