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

Function TEST_F

gpcontrib/gpcloud/test/gpwriter_test.cpp:30–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28};
29
30TEST_F(GPWriterTest, ConstructKeyName) {
31 string url = "https://s3-us-west-2.amazonaws.com/s3test.pivotal.io/dataset1/normal";
32
33 S3Params p = InitConfig(url + " config=data/s3test.conf");
34 p.setAutoCompress(false);
35
36 MockS3RESTfulService mockRESTfulService(p);
37 MockGPWriter gpwriter(p, &mockRESTfulService);
38 EXPECT_CALL(mockRESTfulService, head(_, _)).WillOnce(Return(404));
39
40 uint8_t xml[] =
41 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
42 "<InitiateMultipartUploadResult"
43 " xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\">"
44 "<Bucket>example-bucket</Bucket>"
45 "<Key>example-object</Key>"
46 "<UploadId>VXBsb2FkIElEIGZvciA2aWWpbmcncyBteS1tb3ZpZS5tMnRzIHVwbG9hZA</UploadId>"
47 "</InitiateMultipartUploadResult>";
48 vector<uint8_t> raw(xml, xml + sizeof(xml) - 1);
49 Response response(RESPONSE_OK, raw);
50
51 EXPECT_CALL(mockRESTfulService, post(_, _, vector<uint8_t>())).WillOnce(Return(response));
52
53 gpwriter.open(p);
54
55 // "0"+".data"'s length is 6
56 EXPECT_EQ((uint64_t)8, gpwriter.getKeyUrlToUpload().length() - url.length() - 6);
57}
58
59TEST_F(GPWriterTest, GenerateUniqueKeyName) {
60 string url = "https://s3-us-west-2.amazonaws.com/s3test.pivotal.io/dataset1/normal";

Callers

nothing calls this directly

Calls 5

setAutoCompressMethod · 0.80
lengthMethod · 0.80
getKeyUrlToUploadMethod · 0.80
InitConfigFunction · 0.50
openMethod · 0.45

Tested by

no test coverage detected