summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPrashanth Pai <ppai@redhat.com>2013-12-27 14:36:06 +0530
committerLuis Pabon <lpabon@redhat.com>2014-01-07 13:49:29 -0800
commitd1c7b1cc4b19a7a0c2c6a594dd47cf40f98223f9 (patch)
tree4a6a1f96ceae5bd748eecf36429cdac0aed3132c /test
parente280f91ff1c2978c617f912c7c83601a478ba359 (diff)
Handle ENOSPC on os.close() operation
It is quite possible that errors on a previous write() operation are first reported at the final close(). For fruther info, refer to: http://review.gluster.org/#/c/6269/ Change-Id: If0fbe2f5109d28c82cb493f2526fd5057f86b556 Signed-off-by: Prashanth Pai <ppai@redhat.com> Reviewed-on: http://review.gluster.org/6608 Reviewed-by: Luis Pabon <lpabon@redhat.com> Tested-by: Luis Pabon <lpabon@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/unit/common/test_fs_utils.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/unit/common/test_fs_utils.py b/test/unit/common/test_fs_utils.py
index 0f5f6f6..dbf052f 100644
--- a/test/unit/common/test_fs_utils.py
+++ b/test/unit/common/test_fs_utils.py
@@ -517,6 +517,15 @@ class TestFsUtils(unittest.TestCase):
finally:
os.remove(tmpfile)
+ def test_do_close_err_ENOSPC(self):
+
+ def _mock_os_close_enospc(fd):
+ raise OSError(errno.ENOSPC, os.strerror(errno.ENOSPC))
+
+ fd, tmpfile = mkstemp()
+ with patch('os.close', _mock_os_close_enospc):
+ self.assertRaises(DiskFileNoSpace, fs.do_close, fd)
+
def test_do_unlink(self):
fd, tmpfile = mkstemp()
try: