]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test/pybind: exercise cephfs.fsync 8835/head
authorXiaoxi Chen <xiaoxchen@ebay.com>
Wed, 4 May 2016 08:06:43 +0000 (16:06 +0800)
committerXiaoxi Chen <xiaoxchen@ebay.com>
Wed, 4 May 2016 08:06:43 +0000 (16:06 +0800)
Signed-off-by: Xiaoxi Chen <xiaoxchen@ebay.com>
src/test/pybind/test_cephfs.py

index baea91420840d4969d4f65bc8d8de322d5148567..ed7132ba574925c665b653c55f4e7115deea0e77 100644 (file)
@@ -48,6 +48,17 @@ def test_statfs():
 def test_syncfs():
     stat = cephfs.sync_fs()
 
+@with_setup(setup_test)
+def test_fsync():
+    fd = cephfs.open('file-1', 'w', 0755)
+    cephfs.write(fd, "asdf", 0)
+    stat = cephfs.fsync(fd, 0)
+    cephfs.write(fd, "qwer", 0)
+    stat = cephfs.fsync(fd, 1)
+    cephfs.close(fd)
+    #sync on non-existing fd (assume fd 12345 is not exists)
+    assert_raises(libcephfs.Error, cephfs.fsync, 12345, 0)
+
 @with_setup(setup_test)
 def test_directory():
     cephfs.mkdir("/temp-directory", 0755)