Page MenuHomePhabricator

D4251.id13473.diff
No OneTemporary

D4251.id13473.diff

diff --git a/services/blob/test/MultiPartUploadTest.cpp b/services/blob/test/MultiPartUploadTest.cpp
--- a/services/blob/test/MultiPartUploadTest.cpp
+++ b/services/blob/test/MultiPartUploadTest.cpp
@@ -1,6 +1,7 @@
#include <gtest/gtest.h>
#include "AwsS3Bucket.h"
+#include "Constants.h"
#include "MultiPartUploader.h"
#include "S3Tools.h"
#include "TestTools.h"
@@ -16,13 +17,12 @@
class MultiPartUploadTest : public testing::Test {
protected:
std::shared_ptr<Aws::S3::S3Client> s3Client;
- const std::string bucketName = "commapp-test";
std::unique_ptr<AwsS3Bucket> bucket;
virtual void SetUp() {
Aws::InitAPI({});
s3Client = std::move(getS3Client());
- bucket = std::make_unique<AwsS3Bucket>(bucketName);
+ bucket = std::make_unique<AwsS3Bucket>(BLOB_BUCKET_NAME);
}
virtual void TearDown() {
@@ -39,7 +39,7 @@
TEST_F(MultiPartUploadTest, ThrowingTooSmallPart) {
std::string objectName = createObject(*bucket);
- MultiPartUploader mpu(s3Client, bucketName, objectName);
+ MultiPartUploader mpu(s3Client, BLOB_BUCKET_NAME, objectName);
mpu.addPart("xxx");
mpu.addPart("xxx");
EXPECT_THROW(mpu.finishUpload(), std::runtime_error);
@@ -47,7 +47,7 @@
TEST_F(MultiPartUploadTest, ThrowingTooSmallPartOneByte) {
std::string objectName = createObject(*bucket);
- MultiPartUploader mpu(s3Client, bucketName, objectName);
+ MultiPartUploader mpu(s3Client, BLOB_BUCKET_NAME, objectName);
mpu.addPart(generateNByes(AWS_MULTIPART_UPLOAD_MINIMUM_CHUNK_SIZE - 1));
mpu.addPart("xxx");
EXPECT_THROW(mpu.finishUpload(), std::runtime_error);
@@ -55,7 +55,7 @@
TEST_F(MultiPartUploadTest, SuccessfulWriteMultipleChunks) {
std::string objectName = createObject(*bucket);
- MultiPartUploader mpu(s3Client, bucketName, objectName);
+ MultiPartUploader mpu(s3Client, BLOB_BUCKET_NAME, objectName);
mpu.addPart(generateNByes(AWS_MULTIPART_UPLOAD_MINIMUM_CHUNK_SIZE));
mpu.addPart("xxx");
mpu.finishUpload();
@@ -69,7 +69,7 @@
TEST_F(MultiPartUploadTest, SuccessfulWriteOneChunk) {
std::string objectName = createObject(*bucket);
- MultiPartUploader mpu(s3Client, bucketName, objectName);
+ MultiPartUploader mpu(s3Client, BLOB_BUCKET_NAME, objectName);
mpu.addPart("xxx");
mpu.finishUpload();
EXPECT_EQ(bucket->getObjectSize(objectName), 3);
diff --git a/services/blob/test/StorageManagerTest.cpp b/services/blob/test/StorageManagerTest.cpp
--- a/services/blob/test/StorageManagerTest.cpp
+++ b/services/blob/test/StorageManagerTest.cpp
@@ -1,5 +1,6 @@
#include <gtest/gtest.h>
+#include "Constants.h"
#include "S3Tools.h"
#include "TestTools.h"
@@ -15,7 +16,6 @@
class StorageManagerTest : public testing::Test {
public:
protected:
- const std::string bucketName = "commapp-test";
const std::string data =
"yiU3VaZlKfTteO10yrWmK1Q5BOvBQrdmj2aBlnoLuhxLfRZK1n8"
"26FRXJAGhPswR1r8yxtwxyLkv3I4J4tlH4brDP10mrB99XpM6";
@@ -30,30 +30,34 @@
};
TEST_F(StorageManagerTest, ObjectOperationsTest) {
- EXPECT_TRUE(getBucket(bucketName).isAvailable());
- std::string objectName = createObject(getBucket(bucketName));
+ EXPECT_TRUE(getBucket(BLOB_BUCKET_NAME).isAvailable());
+ std::string objectName = createObject(getBucket(BLOB_BUCKET_NAME));
- getBucket(bucketName).writeObject(objectName, data);
+ getBucket(BLOB_BUCKET_NAME).writeObject(objectName, data);
- EXPECT_EQ(getBucket(bucketName).getObjectSize(objectName), data.size());
- EXPECT_TRUE(getBucket(bucketName).getObjectData(objectName) == data);
+ EXPECT_EQ(getBucket(BLOB_BUCKET_NAME).getObjectSize(objectName), data.size());
+ EXPECT_TRUE(getBucket(BLOB_BUCKET_NAME).getObjectData(objectName) == data);
std::string chunkedData;
const size_t chunkSize = data.size() / 10;
std::function<void(const std::string &)> callback =
[&chunkedData](const std::string &chunk) { chunkedData += chunk; };
- getBucket(bucketName).getObjectDataChunks(objectName, callback, chunkSize);
+ getBucket(BLOB_BUCKET_NAME)
+ .getObjectDataChunks(objectName, callback, chunkSize);
EXPECT_TRUE(data == chunkedData);
- getBucket(bucketName).renameObject(objectName, objectName + "c");
+ getBucket(BLOB_BUCKET_NAME).renameObject(objectName, objectName + "c");
EXPECT_THROW(
- getBucket(bucketName).getObjectData(objectName), std::runtime_error);
- EXPECT_TRUE(getBucket(bucketName).getObjectData(objectName + "c") == data);
- getBucket(bucketName).renameObject(objectName + "c", objectName);
+ getBucket(BLOB_BUCKET_NAME).getObjectData(objectName),
+ std::runtime_error);
+ EXPECT_TRUE(
+ getBucket(BLOB_BUCKET_NAME).getObjectData(objectName + "c") == data);
+ getBucket(BLOB_BUCKET_NAME).renameObject(objectName + "c", objectName);
- getBucket(bucketName).clearObject(objectName);
- EXPECT_EQ(getBucket(bucketName).getObjectSize(objectName), 0);
+ getBucket(BLOB_BUCKET_NAME).clearObject(objectName);
+ EXPECT_EQ(getBucket(BLOB_BUCKET_NAME).getObjectSize(objectName), 0);
- getBucket(bucketName).removeObject(objectName);
+ getBucket(BLOB_BUCKET_NAME).removeObject(objectName);
EXPECT_THROW(
- getBucket(bucketName).getObjectData(objectName), std::runtime_error);
+ getBucket(BLOB_BUCKET_NAME).getObjectData(objectName),
+ std::runtime_error);
}

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 19, 11:04 PM (20 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2678661
Default Alt Text
D4251.id13473.diff (5 KB)

Event Timeline