#include "librbd/WatchNotifyTypes.h"
#include "test/librados/test.h"
#include "gtest/gtest.h"
-#include <boost/assign/list_of.hpp>
#include <boost/assign/std/set.hpp>
#include <boost/assign/std/map.hpp>
#include <boost/bind.hpp>
ASSERT_EQ(0, open_image(m_image_name, &ictx));
ASSERT_EQ(0, register_image_watch(*ictx));
- m_notify_acks = boost::assign::list_of(
- std::make_pair(NOTIFY_OP_ACQUIRED_LOCK, bufferlist()));
+ m_notify_acks = {{NOTIFY_OP_ACQUIRED_LOCK, {}}};
{
RWLock::WLocker l(ictx->owner_lock);
ASSERT_EQ(0, open_image(m_image_name, &ictx));
ASSERT_EQ(0, register_image_watch(*ictx));
- m_notify_acks = boost::assign::list_of(
- std::make_pair(NOTIFY_OP_ACQUIRED_LOCK, bufferlist()));
+ m_notify_acks = {{NOTIFY_OP_ACQUIRED_LOCK, {}}};
{
RWLock::WLocker l(ictx->owner_lock);
ASSERT_EQ(0, lock_image(*ictx, LOCK_EXCLUSIVE,
"auto " + stringify(m_watch_ctx->get_handle())));
- m_notify_acks = boost::assign::list_of(
- std::make_pair(NOTIFY_OP_REQUEST_LOCK, create_response_message(0)));
+ m_notify_acks = {{NOTIFY_OP_REQUEST_LOCK, create_response_message(0)}};
{
RWLock::WLocker l(ictx->owner_lock);
ASSERT_EQ(0, unlock_image());
m_notifies.clear();
- m_notify_acks = boost::assign::list_of(
- std::make_pair(NOTIFY_OP_RELEASED_LOCK, bufferlist()))(
- std::make_pair(NOTIFY_OP_ACQUIRED_LOCK, bufferlist()));
+ m_notify_acks = {{NOTIFY_OP_RELEASED_LOCK,{}}, {NOTIFY_OP_ACQUIRED_LOCK,{}}};
bufferlist bl;
{
ASSERT_EQ(0, lock_image(*ictx, LOCK_EXCLUSIVE,
"auto " + stringify(m_watch_ctx->get_handle())));
- m_notify_acks = boost::assign::list_of(
- std::make_pair(NOTIFY_OP_REQUEST_LOCK, bufferlist()));
+ m_notify_acks = {{NOTIFY_OP_REQUEST_LOCK, {}}};
m_expected_aio_restarts = 1;
{
ASSERT_EQ(0, lock_image(*ictx, LOCK_EXCLUSIVE,
"auto " + stringify(m_watch_ctx->get_handle())));
- m_notify_acks = boost::assign::list_of(
- std::make_pair(NOTIFY_OP_REQUEST_LOCK, create_response_message(0)));
+ m_notify_acks = {{NOTIFY_OP_REQUEST_LOCK, create_response_message(0)}};
int orig_notify_timeout = ictx->cct->_conf->client_notify_timeout;
ictx->cct->_conf->set_val("client_notify_timeout", "0");
ASSERT_EQ(0, lock_image(*ictx, LOCK_EXCLUSIVE,
"auto " + stringify(m_watch_ctx->get_handle())));
- m_notify_acks = boost::assign::list_of(
- std::make_pair(NOTIFY_OP_REQUEST_LOCK, create_response_message(0)));
+ m_notify_acks = {{NOTIFY_OP_REQUEST_LOCK, create_response_message(0)}};
m_expected_aio_restarts = 1;
{
ASSERT_EQ(expected_notify_ops, m_notifies);
m_notifies.clear();
- m_notify_acks = boost::assign::list_of(
- std::make_pair(NOTIFY_OP_RELEASED_LOCK, bufferlist()));
+ m_notify_acks = {{NOTIFY_OP_RELEASED_LOCK, {}}};
bufferlist bl;
{
ASSERT_EQ(0, lock_image(*ictx, LOCK_EXCLUSIVE,
"auto " + stringify(m_watch_ctx->get_handle())));
- m_notify_acks = boost::assign::list_of(
- std::make_pair(NOTIFY_OP_REQUEST_LOCK, create_response_message(0)));
+ m_notify_acks = {{NOTIFY_OP_REQUEST_LOCK, create_response_message(0)}};
m_expected_aio_restarts = 1;
{
ASSERT_EQ(0, lock_image(*ictx, LOCK_SHARED, "manually 1234"));
m_notifies.clear();
- m_notify_acks = boost::assign::list_of(
- std::make_pair(NOTIFY_OP_RELEASED_LOCK, bufferlist()));
+ m_notify_acks = {{NOTIFY_OP_RELEASED_LOCK, bufferlist()}};
bufferlist bl;
{
ASSERT_EQ(0, register_image_watch(*ictx));
- m_notify_acks = boost::assign::list_of(
- std::make_pair(NOTIFY_OP_HEADER_UPDATE, bufferlist()));
+ m_notify_acks = {{NOTIFY_OP_HEADER_UPDATE, {}}};
librbd::ImageWatcher::notify_header_update(m_ioctx, ictx->header_oid);
ASSERT_TRUE(wait_for_notifies(*ictx));
ASSERT_EQ(0, lock_image(*ictx, LOCK_EXCLUSIVE,
"auto " + stringify(m_watch_ctx->get_handle())));
- m_notify_acks = boost::assign::list_of(
- std::make_pair(NOTIFY_OP_FLATTEN, create_response_message(0)));
+ m_notify_acks = {{NOTIFY_OP_FLATTEN, create_response_message(0)}};
ProgressContext progress_context;
FlattenTask flatten_task(ictx, &progress_context);
ASSERT_EQ(0, lock_image(*ictx, LOCK_EXCLUSIVE,
"auto " + stringify(m_watch_ctx->get_handle())));
- m_notify_acks = boost::assign::list_of(
- std::make_pair(NOTIFY_OP_RESIZE, create_response_message(0)));
+ m_notify_acks = {{NOTIFY_OP_RESIZE, create_response_message(0)}};
ProgressContext progress_context;
ResizeTask resize_task(ictx, &progress_context);
ASSERT_EQ(0, lock_image(*ictx, LOCK_EXCLUSIVE,
"auto " + stringify(m_watch_ctx->get_handle())));
- m_notify_acks = boost::assign::list_of(
- std::make_pair(NOTIFY_OP_REBUILD_OBJECT_MAP, create_response_message(0)));
+ m_notify_acks = {{NOTIFY_OP_REBUILD_OBJECT_MAP, create_response_message(0)}};
ProgressContext progress_context;
RebuildObjectMapTask rebuild_task(ictx, &progress_context);
ASSERT_EQ(0, lock_image(*ictx, LOCK_EXCLUSIVE,
"auto " + stringify(m_watch_ctx->get_handle())));
- m_notify_acks = boost::assign::list_of(
- std::make_pair(NOTIFY_OP_SNAP_CREATE, create_response_message(0)));
+ m_notify_acks = {{NOTIFY_OP_SNAP_CREATE, create_response_message(0)}};
RWLock::RLocker l(ictx->owner_lock);
ASSERT_EQ(0, ictx->image_watcher->notify_snap_create("snap"));
ASSERT_EQ(0, lock_image(*ictx, LOCK_EXCLUSIVE,
"auto " + stringify(m_watch_ctx->get_handle())));
- m_notify_acks = boost::assign::list_of(
- std::make_pair(NOTIFY_OP_SNAP_CREATE, create_response_message(-EEXIST)));
+ m_notify_acks = {{NOTIFY_OP_SNAP_CREATE, create_response_message(-EEXIST)}};
RWLock::RLocker l(ictx->owner_lock);
ASSERT_EQ(-EEXIST, ictx->image_watcher->notify_snap_create("snap"));
ASSERT_EQ(0, lock_image(*ictx, LOCK_EXCLUSIVE,
"auto " + stringify(m_watch_ctx->get_handle())));
- m_notify_acks = boost::assign::list_of(
- std::make_pair(NOTIFY_OP_SNAP_REMOVE, create_response_message(0)));
+ m_notify_acks = {{NOTIFY_OP_SNAP_REMOVE, create_response_message(0)}};
RWLock::RLocker l(ictx->owner_lock);
ASSERT_EQ(0, ictx->image_watcher->notify_snap_remove("snap"));
ASSERT_EQ(0, lock_image(*ictx, LOCK_EXCLUSIVE,
"auto " + stringify(m_watch_ctx->get_handle())));
- m_notify_acks = boost::assign::list_of(
- std::make_pair(NOTIFY_OP_FLATTEN, bufferlist()));
+ m_notify_acks = {{NOTIFY_OP_FLATTEN, {}}};
ProgressContext progress_context;
FlattenTask flatten_task(ictx, &progress_context);
ASSERT_EQ(0, lock_image(*ictx, LOCK_EXCLUSIVE,
"auto " + stringify(m_watch_ctx->get_handle())));
- m_notify_acks = boost::assign::list_of(
- std::make_pair(NOTIFY_OP_FLATTEN, create_response_message(-EIO)));
+ m_notify_acks = {{NOTIFY_OP_FLATTEN, create_response_message(-EIO)}};
ProgressContext progress_context;
FlattenTask flatten_task(ictx, &progress_context);
ASSERT_EQ(0, lock_image(*ictx, LOCK_EXCLUSIVE,
"auto " + stringify(m_watch_ctx->get_handle())));
- m_notify_acks = boost::assign::list_of(
- std::make_pair(NOTIFY_OP_FLATTEN, create_response_message(0)));
+ m_notify_acks = {{NOTIFY_OP_FLATTEN, create_response_message(0)}};
ProgressContext progress_context;
FlattenTask flatten_task(ictx, &progress_context);
ASSERT_EQ(0, lock_image(*ictx, LOCK_EXCLUSIVE,
"auto " + stringify(m_watch_ctx->get_handle())));
- m_notify_acks = boost::assign::list_of(
- std::make_pair(NOTIFY_OP_FLATTEN, create_response_message(0)));
+ m_notify_acks = {{NOTIFY_OP_FLATTEN, create_response_message(0)}};
ProgressContext progress_context;
FlattenTask flatten_task(ictx, &progress_context);