summaryrefslogtreecommitdiffstats
path: root/test/unit/common/test_utils.py
diff options
context:
space:
mode:
authorPrashanth Pai <ppai@redhat.com>2016-05-26 15:00:13 +0530
committerThiago da Silva <thiago@redhat.com>2016-11-18 09:48:42 -0800
commit3330c26f199f4a149bf0091259d88534d61f53fa (patch)
treeca9a4cd433c0887a807b5919ea926aa367803cbf /test/unit/common/test_utils.py
parentce0feed60b2077085a66d34021a3c96bbb7f5558 (diff)
Fix redundant stat in account and container server
Multiple stat() calls were made while serving GET requests for container and account. This removes those calls and can be easily verified using strace. There is room for further refactoring of code to simplify it. This will be addressed as a separate change to keep things simple in this patch. Change-Id: Ief457ff869c58519e9dbeb4ef13797185f536673 Signed-off-by: Prashanth Pai <ppai@redhat.com> Reviewed-on: http://review.gluster.org/14543 Reviewed-by: Thiago da Silva <thiago@redhat.com> Tested-by: Thiago da Silva <thiago@redhat.com>
Diffstat (limited to 'test/unit/common/test_utils.py')
-rw-r--r--test/unit/common/test_utils.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/test/unit/common/test_utils.py b/test/unit/common/test_utils.py
index 4790304..136c3a9 100644
--- a/test/unit/common/test_utils.py
+++ b/test/unit/common/test_utils.py
@@ -670,9 +670,13 @@ class TestUtils(unittest.TestCase):
def test_get_account_details_notadir(self):
tf = tempfile.NamedTemporaryFile()
- container_list, container_count = utils.get_account_details(tf.name)
- assert container_count == 0
- assert container_list == []
+ try:
+ utils.get_account_details(tf.name)
+ except OSError as err:
+ if err.errno != errno.ENOTDIR:
+ self.fail("Expecting ENOTDIR")
+ else:
+ self.fail("Expecting ENOTDIR")
def test_get_container_details_notadir(self):
tf = tempfile.NamedTemporaryFile()