summaryrefslogtreecommitdiffstats
path: root/src/test/librbd/mock
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-23 16:45:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-23 16:45:13 +0000
commit389020e14594e4894e28d1eb9103c210b142509e (patch)
tree2ba734cdd7a243f46dda7c3d0cc88c2293d9699f /src/test/librbd/mock
parentAdding upstream version 18.2.2. (diff)
downloadceph-389020e14594e4894e28d1eb9103c210b142509e.tar.xz
ceph-389020e14594e4894e28d1eb9103c210b142509e.zip
Adding upstream version 18.2.3.upstream/18.2.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--src/test/librbd/mock/MockObjectMap.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/test/librbd/mock/MockObjectMap.h b/src/test/librbd/mock/MockObjectMap.h
index 2a1adbcae..5e3235cf0 100644
--- a/src/test/librbd/mock/MockObjectMap.h
+++ b/src/test/librbd/mock/MockObjectMap.h
@@ -4,19 +4,27 @@
#ifndef CEPH_TEST_LIBRBD_MOCK_OBJECT_MAP_H
#define CEPH_TEST_LIBRBD_MOCK_OBJECT_MAP_H
+#include "common/bit_vector.hpp"
#include "librbd/Utils.h"
#include "gmock/gmock.h"
namespace librbd {
struct MockObjectMap {
- MOCK_METHOD1(at, uint8_t(uint64_t));
- uint8_t operator[](uint64_t object_no) {
+ MOCK_CONST_METHOD1(at, uint8_t(uint64_t));
+ uint8_t operator[](uint64_t object_no) const {
return at(object_no);
}
MOCK_CONST_METHOD0(size, uint64_t());
+ MOCK_CONST_METHOD0(with, ceph::BitVector<2>());
+ template <typename F, typename... Args>
+ auto with_object_map(F&& f, Args&&... args) const {
+ const ceph::BitVector<2> object_map = with();
+ return std::forward<F>(f)(object_map, std::forward<Args>(args)...);
+ }
+
MOCK_METHOD1(open, void(Context *on_finish));
MOCK_METHOD1(close, void(Context *on_finish));