summaryrefslogtreecommitdiffstats
path: root/src/test/cls_journal
diff options
context:
space:
mode:
authorJason Dillaman <dillaman@redhat.com>2016-03-15 20:50:31 +0100
committerJason Dillaman <dillaman@redhat.com>2016-03-16 01:38:34 +0100
commit353f895ac3281a888f92877b435ec2c8571d0b71 (patch)
treec8baa71020aef0e50e6fe842176805707dfab35f /src/test/cls_journal
parentlibrbd: initial implementation of mirror image promote/demote (diff)
downloadceph-353f895ac3281a888f92877b435ec2c8571d0b71.tar.xz
ceph-353f895ac3281a888f92877b435ec2c8571d0b71.zip
journal: add placeholder for marking clients are disconnected
When a client is disconnected from the journal, entries can be pruned regardless of the affected client's commit position. Signed-off-by: Jason Dillaman <dillaman@redhat.com>
Diffstat (limited to 'src/test/cls_journal')
-rw-r--r--src/test/cls_journal/test_cls_journal.cc31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/test/cls_journal/test_cls_journal.cc b/src/test/cls_journal/test_cls_journal.cc
index 1eb7663da76..9c6000dfd46 100644
--- a/src/test/cls_journal/test_cls_journal.cc
+++ b/src/test/cls_journal/test_cls_journal.cc
@@ -235,19 +235,20 @@ TEST_F(TestClsJournal, ClientRegisterDuplicate) {
ASSERT_EQ(-EEXIST, client::client_register(ioctx, oid, "id1", bufferlist()));
}
-TEST_F(TestClsJournal, ClientUpdate) {
+TEST_F(TestClsJournal, ClientUpdateData) {
librados::IoCtx ioctx;
ASSERT_EQ(0, _rados.ioctx_create(_pool_name.c_str(), ioctx));
std::string oid = get_temp_image_name();
- ASSERT_EQ(-ENOENT, client::client_update(ioctx, oid, "id1", bufferlist()));
+ ASSERT_EQ(-ENOENT, client::client_update_data(ioctx, oid, "id1",
+ bufferlist()));
ASSERT_EQ(0, client::client_register(ioctx, oid, "id1", bufferlist()));
bufferlist data;
data.append(std::string('1', 128));
- ASSERT_EQ(0, client::client_update(ioctx, oid, "id1", data));
+ ASSERT_EQ(0, client::client_update_data(ioctx, oid, "id1", data));
Client client;
ASSERT_EQ(0, client::get_client(ioctx, oid, "id1", &client));
@@ -255,6 +256,30 @@ TEST_F(TestClsJournal, ClientUpdate) {
ASSERT_EQ(expected_client, client);
}
+TEST_F(TestClsJournal, ClientUpdateState) {
+ librados::IoCtx ioctx;
+ ASSERT_EQ(0, _rados.ioctx_create(_pool_name.c_str(), ioctx));
+
+ std::string oid = get_temp_image_name();
+
+ ASSERT_EQ(-ENOENT, client::client_update_state(ioctx, oid, "id1",
+ CLIENT_STATE_DISCONNECTED));
+
+ ASSERT_EQ(0, client::client_register(ioctx, oid, "id1", bufferlist()));
+
+ bufferlist data;
+ data.append(std::string('1', 128));
+ ASSERT_EQ(0, client::client_update_state(ioctx, oid, "id1",
+ CLIENT_STATE_DISCONNECTED));
+
+ Client client;
+ ASSERT_EQ(0, client::get_client(ioctx, oid, "id1", &client));
+ Client expected_client;
+ expected_client.id = "id1";
+ expected_client.state = CLIENT_STATE_DISCONNECTED;
+ ASSERT_EQ(expected_client, client);
+}
+
TEST_F(TestClsJournal, ClientUnregister) {
librados::IoCtx ioctx;
ASSERT_EQ(0, _rados.ioctx_create(_pool_name.c_str(), ioctx));