]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/test_rados: test aio_rmxattr() 37630/head
authorzhangjiao <zhangjiao_yewu@cmss.chinamobile.com>
Mon, 12 Oct 2020 05:23:22 +0000 (13:23 +0800)
committerzhangjiao <zhangjiao_yewu@cmss.chinamobile.com>
Fri, 6 Nov 2020 02:59:20 +0000 (10:59 +0800)
Signed-off-by: Zhang Jiao <zhangjiao_yewu@cmss.chinamobile.com>
src/test/pybind/test_rados.py

index 55754161095750b981b28162f537257a61c8afe4..39607d35e101f06491e10874530e5f872f7319d0 100644 (file)
@@ -5,7 +5,7 @@ from nose.tools import eq_ as eq, ok_ as ok, assert_raises
 from rados import (Rados, Error, RadosStateError, Object, ObjectExists,
                    ObjectNotFound, ObjectBusy, NotConnected,
                    LIBRADOS_ALL_NSPACES, WriteOpCtx, ReadOpCtx, LIBRADOS_CREATE_EXCLUSIVE,
-                   LIBRADOS_SNAP_HEAD, LIBRADOS_OPERATION_BALANCE_READS, LIBRADOS_OPERATION_SKIPRWLOCKS, MonitorLog, MAX_ERRNO)
+                   LIBRADOS_SNAP_HEAD, LIBRADOS_OPERATION_BALANCE_READS, LIBRADOS_OPERATION_SKIPRWLOCKS, MonitorLog, MAX_ERRNO, NoData)
 from datetime import timedelta
 import time
 import threading
@@ -675,6 +675,25 @@ class TestIoctx(object):
                 lock.wait()
         eq(comp.get_return_value(), 0)
 
+    def test_aio_rmxattr(self):
+        lock = threading.Condition()
+        count = [0]
+        def cb(blah):
+            with lock:
+                count[0] += 1
+                lock.notify()
+            return 0
+        self.ioctx.set_xattr("xyz", "key", b'value')
+        eq(self.ioctx.get_xattr("xyz", "key"), b'value')
+        comp = self.ioctx.aio_rmxattr("xyz", "key", cb)
+        comp.wait_for_complete()
+        with lock:
+            while count[0] < 1:
+                lock.wait()
+        eq(comp.get_return_value(), 0)
+        with assert_raises(NoData):
+            self.ioctx.get_xattr("xyz", "key")
+
     def test_aio_write_no_comp_ref(self):
         lock = threading.Condition()
         count = [0]