From: David Zafman Date: Fri, 28 Mar 2014 21:15:43 +0000 (-0700) Subject: test: Add EC to ceph_test_rados_api_watch_notify X-Git-Tag: v0.79~28^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=38b9fe7c9b35818f8dd35a9f96b98b433a502e11;p=ceph.git test: Add EC to ceph_test_rados_api_watch_notify Signed-off-by: David Zafman --- diff --git a/src/test/librados/watch_notify.cc b/src/test/librados/watch_notify.cc index 8616b5cb16ed..44c2a95373df 100644 --- a/src/test/librados/watch_notify.cc +++ b/src/test/librados/watch_notify.cc @@ -12,6 +12,8 @@ using namespace librados; typedef RadosTest LibRadosWatchNotify; typedef RadosTestPP LibRadosWatchNotifyPP; +typedef RadosTestEC LibRadosWatchNotifyEC; +typedef RadosTestECPP LibRadosWatchNotifyECPP; static sem_t sem; @@ -80,3 +82,55 @@ TEST_F(LibRadosWatchNotifyPP, WatchNotifyTimeoutTestPP) { ASSERT_EQ(0, ioctx.watch("foo", 0, &handle, &ctx)); sem_destroy(&sem); } + +TEST_F(LibRadosWatchNotifyEC, WatchNotifyTest) { + ASSERT_EQ(0, sem_init(&sem, 0, 0)); + char buf[128]; + memset(buf, 0xcc, sizeof(buf)); + ASSERT_EQ((int)sizeof(buf), rados_write(ioctx, "foo", buf, sizeof(buf), 0)); + uint64_t handle; + ASSERT_EQ(0, + rados_watch(ioctx, "foo", 0, &handle, watch_notify_test_cb, NULL)); + ASSERT_EQ(0, rados_notify(ioctx, "foo", 0, NULL, 0)); + TestAlarm alarm; + sem_wait(&sem); + rados_unwatch(ioctx, "foo", handle); + sem_destroy(&sem); +} + +TEST_F(LibRadosWatchNotifyECPP, WatchNotifyTestPP) { + ASSERT_EQ(0, sem_init(&sem, 0, 0)); + char buf[128]; + memset(buf, 0xcc, sizeof(buf)); + bufferlist bl1; + bl1.append(buf, sizeof(buf)); + ASSERT_EQ((int)sizeof(buf), ioctx.write("foo", bl1, sizeof(buf), 0)); + uint64_t handle; + WatchNotifyTestCtx ctx; + ASSERT_EQ(0, ioctx.watch("foo", 0, &handle, &ctx)); + std::list watches; + ASSERT_EQ(0, ioctx.list_watchers("foo", &watches)); + ASSERT_EQ(watches.size(), 1u); + bufferlist bl2; + ASSERT_EQ(0, ioctx.notify("foo", 0, bl2)); + TestAlarm alarm; + sem_wait(&sem); + ioctx.unwatch("foo", handle); + sem_destroy(&sem); +} + +TEST_F(LibRadosWatchNotifyECPP, WatchNotifyTimeoutTestPP) { + ASSERT_EQ(0, sem_init(&sem, 0, 0)); + ioctx.set_notify_timeout(1); + uint64_t handle; + WatchNotifyTestCtx ctx; + + char buf[128]; + memset(buf, 0xcc, sizeof(buf)); + bufferlist bl1; + bl1.append(buf, sizeof(buf)); + ASSERT_EQ((int)sizeof(buf), ioctx.write("foo", bl1, sizeof(buf), 0)); + + ASSERT_EQ(0, ioctx.watch("foo", 0, &handle, &ctx)); + sem_destroy(&sem); +}