From e741c146cd5d6483e3885d26db1c890d1bdfd71a Mon Sep 17 00:00:00 2001 From: huanwen ren Date: Tue, 10 May 2016 19:51:23 +0800 Subject: [PATCH] test/pybind: add link test usecase add link test usecase Signed-off-by: huanwen ren --- src/test/pybind/test_cephfs.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/test/pybind/test_cephfs.py b/src/test/pybind/test_cephfs.py index baea91420840..e1b33e178ec9 100644 --- a/src/test/pybind/test_cephfs.py +++ b/src/test/pybind/test_cephfs.py @@ -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) -- 2.47.3