diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
commit | e6918187568dbd01842d8d1d2c808ce16a894239 (patch) | |
tree | 64f88b554b444a49f656b6c656111a145cbbaa28 /src/test/rbd_mirror/mock | |
parent | Initial commit. (diff) | |
download | ceph-e6918187568dbd01842d8d1d2c808ce16a894239.tar.xz ceph-e6918187568dbd01842d8d1d2c808ce16a894239.zip |
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/rbd_mirror/mock')
-rw-r--r-- | src/test/rbd_mirror/mock/MockBaseRequest.h | 26 | ||||
-rw-r--r-- | src/test/rbd_mirror/mock/MockContextWQ.h | 18 | ||||
-rw-r--r-- | src/test/rbd_mirror/mock/MockSafeTimer.h | 16 | ||||
-rw-r--r-- | src/test/rbd_mirror/mock/image_sync/MockSyncPointHandler.h | 29 |
4 files changed, 89 insertions, 0 deletions
diff --git a/src/test/rbd_mirror/mock/MockBaseRequest.h b/src/test/rbd_mirror/mock/MockBaseRequest.h new file mode 100644 index 000000000..c85eab434 --- /dev/null +++ b/src/test/rbd_mirror/mock/MockBaseRequest.h @@ -0,0 +1,26 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab + +#ifndef CEPH_MOCK_BASE_REQUEST_H +#define CEPH_MOCK_BASE_REQUEST_H + +#include "tools/rbd_mirror/BaseRequest.h" +#include <gmock/gmock.h> + +struct Context; + +namespace rbd { +namespace mirror { + +struct MockBaseRequest : public BaseRequest { + MockBaseRequest() : BaseRequest(nullptr) {} + + Context* on_finish = nullptr; + + MOCK_METHOD0(send, void()); +}; + +} // namespace mirror +} // namepace rbd + +#endif // CEPH_MOCK_BASE_REQUEST_H diff --git a/src/test/rbd_mirror/mock/MockContextWQ.h b/src/test/rbd_mirror/mock/MockContextWQ.h new file mode 100644 index 000000000..1c0ee88f5 --- /dev/null +++ b/src/test/rbd_mirror/mock/MockContextWQ.h @@ -0,0 +1,18 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab + +#ifndef CEPH_MOCK_CONTEXT_WQ_H +#define CEPH_MOCK_CONTEXT_WQ_H + +#include <gmock/gmock.h> + +struct Context; + +struct MockContextWQ { + void queue(Context *ctx) { + queue(ctx, 0); + } + MOCK_METHOD2(queue, void(Context *, int)); +}; + +#endif // CEPH_MOCK_CONTEXT_WQ_H diff --git a/src/test/rbd_mirror/mock/MockSafeTimer.h b/src/test/rbd_mirror/mock/MockSafeTimer.h new file mode 100644 index 000000000..32d58471d --- /dev/null +++ b/src/test/rbd_mirror/mock/MockSafeTimer.h @@ -0,0 +1,16 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab + +#ifndef CEPH_MOCK_SAFE_TIMER_H +#define CEPH_MOCK_SAFE_TIMER_H + +#include <gmock/gmock.h> + +struct Context; + +struct MockSafeTimer { + MOCK_METHOD2(add_event_after, Context*(double, Context*)); + MOCK_METHOD1(cancel_event, bool(Context *)); +}; + +#endif // CEPH_MOCK_SAFE_TIMER_H diff --git a/src/test/rbd_mirror/mock/image_sync/MockSyncPointHandler.h b/src/test/rbd_mirror/mock/image_sync/MockSyncPointHandler.h new file mode 100644 index 000000000..b6263cbdf --- /dev/null +++ b/src/test/rbd_mirror/mock/image_sync/MockSyncPointHandler.h @@ -0,0 +1,29 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab + +#ifndef CEPH_MOCK_IMAGE_SYNC_SYNC_POINT_HANDLER_H +#define CEPH_MOCK_IMAGE_SYNC_SYNC_POINT_HANDLER_H + +#include "tools/rbd_mirror/image_sync/Types.h" +#include <gmock/gmock.h> + +struct Context; + +namespace rbd { +namespace mirror { +namespace image_sync { + +struct MockSyncPointHandler : public SyncPointHandler{ + MOCK_CONST_METHOD0(get_sync_points, SyncPoints()); + MOCK_CONST_METHOD0(get_snap_seqs, librbd::SnapSeqs()); + + MOCK_METHOD4(update_sync_points, void(const librbd::SnapSeqs&, + const SyncPoints&, + bool, Context*)); +}; + +} // namespace image_sync +} // namespace mirror +} // namespace rbd + +#endif // CEPH_MOCK_IMAGE_SYNC_SYNC_POINT_HANDLER_H |