pybind/test_rados: test aio_rmxattr()

Signed-off-by: Zhang Jiao <zhangjiao_yewu@cmss.chinamobile.com>
This commit is contained in:
zhangjiao 2020-10-12 13:23:22 +08:00
parent f056150b53
commit 4828168277

View 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]