summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorSamuel Just <sam.just@inktank.com>2014-03-11 19:25:47 +0100
committerSamuel Just <sam.just@inktank.com>2014-03-13 00:26:00 +0100
commit9d549eb2f456b2d6b493c34eccbf72eb372281f6 (patch)
tree66b5ac2d35bc4465032ecc3ac29e793918e02a0f /src/test
parentReplicatedPG: CEPH_OSD_OP_WATCH return -ENOENT if !obs.exists (diff)
downloadceph-9d549eb2f456b2d6b493c34eccbf72eb372281f6.tar.xz
ceph-9d549eb2f456b2d6b493c34eccbf72eb372281f6.zip
test/system/st_rados_watch: expect ENOENT for watch on non-existent object
Signed-off-by: Samuel Just <sam.just@inktank.com>
Diffstat (limited to '')
-rw-r--r--src/test/system/rados_watch_notify.cc8
-rw-r--r--src/test/system/st_rados_watch.cc12
-rw-r--r--src/test/system/st_rados_watch.h2
3 files changed, 15 insertions, 7 deletions
diff --git a/src/test/system/rados_watch_notify.cc b/src/test/system/rados_watch_notify.cc
index e549d386505..6517f33ebe8 100644
--- a/src/test/system/rados_watch_notify.cc
+++ b/src/test/system/rados_watch_notify.cc
@@ -70,7 +70,7 @@ int main(int argc, const char **argv)
{
StRadosCreatePool r1(argc, argv, NULL, setup_sem, NULL, pool, 1, ".obj");
StRadosWatch r2(argc, argv, setup_sem, watch_sem, notify_sem,
- 1, pool, "0.obj");
+ 1, 0, pool, "0.obj");
StRadosNotify r3(argc, argv, setup_sem, watch_sem, notify_sem,
0, pool, "0.obj");
vector<SysTestRunnable*> vec;
@@ -94,7 +94,7 @@ int main(int argc, const char **argv)
{
StRadosCreatePool r1(argc, argv, NULL, setup_sem, NULL, pool, 0, ".obj");
StRadosWatch r2(argc, argv, setup_sem, watch_sem, notify_sem,
- 0, pool, "0.obj");
+ 0, -ENOENT, pool, "0.obj");
StRadosNotify r3(argc, argv, setup_sem, watch_sem, notify_sem,
-ENOENT, pool, "0.obj");
vector<SysTestRunnable*> vec;
@@ -127,7 +127,7 @@ int main(int argc, const char **argv)
{
StRadosCreatePool r1(argc, argv, NULL, setup_sem, NULL, pool, 1, ".obj");
StRadosWatch r2(argc, argv, setup_sem, watch_sem, finished_notifies_sem,
- 1, pool, "0.obj");
+ 1, 0, pool, "0.obj");
StRadosNotify r3(argc, argv, setup_sem, watch_sem, notify_sem,
0, pool, "0.obj");
StRadosDeletePool r4(argc, argv, notify_sem, deleted_sem, pool);
@@ -165,7 +165,7 @@ int main(int argc, const char **argv)
{
StRadosCreatePool r1(argc, argv, NULL, setup_sem, NULL, pool, 1, ".obj");
StRadosWatch r2(argc, argv, setup_sem, watch_sem, finished_notifies_sem,
- 1, pool, "0.obj");
+ 1, 0, pool, "0.obj");
StRadosNotify r3(argc, argv, setup_sem, watch_sem, notify_sem,
0, pool, "0.obj");
StRadosDeleteObjs r4(argc, argv, notify_sem, deleted_sem, 1, pool, ".obj");
diff --git a/src/test/system/st_rados_watch.cc b/src/test/system/st_rados_watch.cc
index 696b0867e88..38b7b5eee85 100644
--- a/src/test/system/st_rados_watch.cc
+++ b/src/test/system/st_rados_watch.cc
@@ -28,6 +28,7 @@ StRadosWatch::StRadosWatch(int argc, const char **argv,
CrossProcessSem *watch_sem,
CrossProcessSem *notify_sem,
int num_notifies,
+ int watch_retcode,
const std::string &pool_name,
const std::string &obj_name)
: SysTestRunnable(argc, argv),
@@ -35,6 +36,7 @@ StRadosWatch::StRadosWatch(int argc, const char **argv,
m_watch_sem(watch_sem),
m_notify_sem(notify_sem),
m_num_notifies(num_notifies),
+ m_watch_retcode(watch_retcode),
m_pool_name(pool_name),
m_obj_name(obj_name)
{
@@ -65,9 +67,13 @@ run()
RETURN1_IF_NONZERO(rados_connect(cl));
RETURN1_IF_NONZERO(rados_ioctx_create(cl, m_pool_name.c_str(), &io_ctx));
printf("%s: watching object %s\n", get_id_str(), m_obj_name.c_str());
- RETURN1_IF_NONZERO(rados_watch(io_ctx, m_obj_name.c_str(), 0, &handle,
- reinterpret_cast<rados_watchcb_t>(notify_cb),
- reinterpret_cast<void*>(&num_notifies)));
+
+ RETURN1_IF_NOT_VAL(
+ rados_watch(io_ctx, m_obj_name.c_str(), 0, &handle,
+ reinterpret_cast<rados_watchcb_t>(notify_cb),
+ reinterpret_cast<void*>(&num_notifies)),
+ m_watch_retcode
+ );
if (m_watch_sem) {
m_watch_sem->post();
}
diff --git a/src/test/system/st_rados_watch.h b/src/test/system/st_rados_watch.h
index e5ae1304b18..e3e78c0cc0e 100644
--- a/src/test/system/st_rados_watch.h
+++ b/src/test/system/st_rados_watch.h
@@ -38,6 +38,7 @@ public:
CrossProcessSem *watch_sem,
CrossProcessSem *notify_sem,
int num_notifies,
+ int watch_retcode,
const std::string &pool_name,
const std::string &obj_name);
~StRadosWatch();
@@ -47,6 +48,7 @@ private:
CrossProcessSem *m_watch_sem;
CrossProcessSem *m_notify_sem;
int m_num_notifies;
+ int m_watch_retcode;
std::string m_pool_name;
std::string m_obj_name;
};