]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test/pybind: add link test usecase 9033/head
authorhuanwen ren <ren.huanwen@zte.com.cn>
Tue, 10 May 2016 11:51:23 +0000 (19:51 +0800)
committerhuanwen ren <ren.huanwen@zte.com.cn>
Tue, 10 May 2016 11:51:23 +0000 (19:51 +0800)
add link test usecase

Signed-off-by: huanwen ren <ren.huanwen@zte.com.cn>
src/test/pybind/test_cephfs.py

index baea91420840d4969d4f65bc8d8de322d5148567..e1b33e178ec9a4979fbd54378f0595f7f80ca67b 100644 (file)
@@ -124,6 +124,23 @@ def test_open():
     assert_raises(libcephfs.OperationNotSupported, cephfs.open, 'file-1', 'a')
     cephfs.unlink('file-1')
 
+@with_setup(setup_test)
+def test_link():
+    fd = cephfs.open('file-1', 'w', 0755)
+    cephfs.write(fd, "1111", 0)
+    cephfs.close(fd)
+    cephfs.link('file-1', 'file-2')
+    fd = cephfs.open('file-2', 'r', 0755)
+    assert_equal(cephfs.read(fd, 0, 4), "1111")
+    cephfs.close(fd)
+    fd = cephfs.open('file-2', 'r+', 0755)
+    cephfs.write(fd, "2222", 4)
+    cephfs.close(fd)
+    fd = cephfs.open('file-1', 'r', 0755)
+    assert_equal(cephfs.read(fd, 0, 8), "11112222")
+    cephfs.close(fd)
+    cephfs.unlink('file-2')
+
 @with_setup(setup_test)
 def test_symlink():
     fd = cephfs.open('file-1', 'w', 0755)