path: root/gluster/swift
diff options
authorPeter Portante <>2013-05-23 20:52:19 -0400
committerLuis Pabon <>2013-05-24 12:17:19 -0700
commite2b9e5e06cc824b006ca984081c4956eaf887393 (patch)
tree6cd07a81cc369bb37abf81649c7b831e4bc364f3 /gluster/swift
parent833d7fc7dfe077b39eade72a5496a40181b20a0c (diff)
Bring DiskFile module coverge to 100%
To bring the DiskFile module coverage to 100%, we first recognize that do_fsync() will invoke fsync() in a separate thread, which gives coverage fits (see the commit history at To avoid that, we mock out do_fsync to make it a no-op and avoid the problem. The second thing we recognize is that mkstemp() relies on do_unlink from the fs_utils module, which already consumes ENOENT errors, so we don't need that code path in mkstemp() itself. The unused mock routine for do_unlink was removed as well, and we renamed the other do_unlink mock routine to os_unlink since it was mocking out os.unlink directly. Lastly, we rejigger the error on close test for mkstemp() to prematurely close the fd to cause an error which should just be squelched, completing the full coverage. Change-Id: I98283c17cf139f92282f8afd7083d567d3dd9a79 Signed-off-by: Peter Portante <> Reviewed-on: Reviewed-by: Luis Pabon <> Tested-by: Luis Pabon <>
Diffstat (limited to 'gluster/swift')
1 files changed, 1 insertions, 5 deletions
diff --git a/gluster/swift/common/ b/gluster/swift/common/
index 577147a..c74921b 100644
--- a/gluster/swift/common/
+++ b/gluster/swift/common/
@@ -332,8 +332,4 @@ class Gluster_DiskFile(DiskFile):
except OSError:
tmppath, self.tmppath = self.tmppath, None
- try:
- do_unlink(tmppath)
- except OSError as err:
- if err.errno != errno.ENOENT:
- raise
+ do_unlink(tmppath)