ret, buf = self.ioctx.execute("foo", "hello", "say_hello", b"nose")
eq(buf, b"Hello, nose!")
+ def test_aio_execute(self):
+ count = [0]
+ retval = [None]
+ lock = threading.Condition()
+ def cb(_, buf):
+ with lock:
+ if retval[0] is None:
+ retval[0] = buf
+ count[0] += 1
+ lock.notify()
+ self.ioctx.write("foo", b"") # ensure object exists
+
+ comp = self.ioctx.aio_execute("foo", "hello", "say_hello", b"", 32, cb, cb)
+ comp.wait_for_complete()
+ with lock:
+ while count[0] < 2:
+ lock.wait()
+ eq(comp.get_return_value(), 13)
+ eq(retval[0], b"Hello, world!")
+
+ retval[0] = None
+ comp = self.ioctx.aio_execute("foo", "hello", "say_hello", b"nose", 32, cb, cb)
+ comp.wait_for_complete()
+ with lock:
+ while count[0] < 4:
+ lock.wait()
+ eq(comp.get_return_value(), 12)
+ eq(retval[0], b"Hello, nose!")
+
+ [i.remove() for i in self.ioctx.list_objects()]
+
class TestObject(object):
def setUp(self):
ret, buf, out = self.rados.mon_command(json.dumps(cmd), b'')
eq(ret, 0)
assert len(out) > 0
- eq(u"pool '\u9ec5' created", out)
\ No newline at end of file
+ eq(u"pool '\u9ec5' created", out)