MCPcopy Create free account
hub / github.com/apache/cloudberry / MockFetchData

Class MockFetchData

gpcontrib/gpcloud/test/s3key_reader_test.cpp:229–249  ·  view source on GitHub ↗

Mock function object of fetchData Precise control return value and content of data buffer.

Source from the content-addressed store, hash-verified

227// Mock function object of fetchData
228// Precise control return value and content of data buffer.
229class MockFetchData {
230 public:
231 MockFetchData(uint64_t returnLen, uint64_t chunkSize)
232 : retnLen(returnLen), chunkData(chunkSize) {
233 }
234
235 MockFetchData(const MockFetchData &other) {
236 retnLen = other.retnLen;
237 chunkData = other.chunkData;
238 }
239
240 uint64_t operator()(uint64_t offset, S3VectorUInt8 &data, uint64_t len,
241 const S3Url &sourceUrl) {
242 data = std::move(chunkData);
243 return retnLen;
244 }
245
246 private:
247 uint64_t retnLen;
248 S3VectorUInt8 chunkData;
249};
250
251TEST_F(S3KeyReaderTest, ReadWithSingleChunk) {
252 S3Params params("s3://abc/def");

Callers 1

TEST_FFunction · 0.85

Calls

no outgoing calls

Tested by 1

TEST_FFunction · 0.68