summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorOr Ozeri <oro@il.ibm.com>2020-07-28 11:08:30 +0200
committerOr Ozeri <oro@il.ibm.com>2020-07-29 13:39:08 +0200
commit143be4cc3cb264a125a0272c796a438af281303a (patch)
tree1cac874c7110f2c72e1aeb3586f376c41182afd5 /src/test
parentMerge pull request #36157 from rhcs-dashboard/fix-46601-master (diff)
downloadceph-143be4cc3cb264a125a0272c796a438af281303a.tar.xz
ceph-143be4cc3cb264a125a0272c796a438af281303a.zip
test/librados_test_stub: handle exclusive create
The exclusive boolean of the create method was unused so far. This commit adds the proper handling by checking if an object already exists, and returning EEXISTS appropriately. Signed-off-by: Or Ozeri <oro@il.ibm.com>
Diffstat (limited to 'src/test')
-rw-r--r--src/test/librados_test_stub/TestMemIoCtxImpl.cc7
-rw-r--r--src/test/librbd/image/test_mock_ValidatePoolRequest.cc1
2 files changed, 8 insertions, 0 deletions
diff --git a/src/test/librados_test_stub/TestMemIoCtxImpl.cc b/src/test/librados_test_stub/TestMemIoCtxImpl.cc
index d1f2f8cda51..24b4ac559a3 100644
--- a/src/test/librados_test_stub/TestMemIoCtxImpl.cc
+++ b/src/test/librados_test_stub/TestMemIoCtxImpl.cc
@@ -108,6 +108,13 @@ int TestMemIoCtxImpl::create(const std::string& oid, bool exclusive,
}
std::unique_lock l{m_pool->file_lock};
+ if (exclusive) {
+ TestMemCluster::SharedFile file = get_file(oid, false, CEPH_NOSNAP, {});
+ if (file != NULL && file->exists) {
+ return -EEXIST;
+ }
+ }
+
get_file(oid, true, CEPH_NOSNAP, snapc);
return 0;
}
diff --git a/src/test/librbd/image/test_mock_ValidatePoolRequest.cc b/src/test/librbd/image/test_mock_ValidatePoolRequest.cc
index 7bb3ead9db9..95e4028ec96 100644
--- a/src/test/librbd/image/test_mock_ValidatePoolRequest.cc
+++ b/src/test/librbd/image/test_mock_ValidatePoolRequest.cc
@@ -39,6 +39,7 @@ public:
void SetUp() override {
TestMockFixture::SetUp();
+ m_ioctx.remove(RBD_INFO);
ASSERT_EQ(0, open_image(m_image_name, &image_ctx));
}