Add Error Codes for S3 Region-Endpoint Mismatch and Invalid Object Storage Endpoint Validation

This commit is contained in:
obdev
2024-03-07 07:15:38 +00:00
committed by ob-robot
parent 82552b3f6b
commit fd55142354
16 changed files with 117 additions and 58 deletions

View File

@ -70,7 +70,7 @@ TEST(ObObjectStorageInfo, oss)
storage_info = "access_id=111&access_key=222";
ASSERT_EQ(OB_INVALID_BACKUP_DEST, info1.set(uri, storage_info));
storage_info = "host=xxx.com&access_id=111&access_key=222";
storage_info = "host=xxx.com&access_id=111&access_key=222&checksum_type=md5";
ASSERT_EQ(OB_SUCCESS, info1.set(uri, storage_info));
char buf[OB_MAX_BACKUP_STORAGE_INFO_LENGTH] = { 0 };
@ -111,7 +111,7 @@ TEST(ObObjectStorageInfo, cos)
storage_info = "host=xxx.com&access_id=111&access_key=222";
ASSERT_EQ(OB_INVALID_BACKUP_DEST, info1.set(uri, storage_info));
storage_info = "host=xxx.com&access_id=111&access_key=222&appid=333";
storage_info = "host=xxx.com&access_id=111&access_key=222&checksum_type=md5&appid=333";
ASSERT_EQ(OB_SUCCESS, info1.set(uri, storage_info));
char buf[OB_MAX_BACKUP_STORAGE_INFO_LENGTH] = { 0 };
@ -150,9 +150,10 @@ TEST(ObObjectStorageInfo, s3)
const char *storage_info = "";
ASSERT_EQ(OB_INVALID_BACKUP_DEST, info1.set(uri, storage_info));
storage_info = "host=xxx.com&access_id=111&access_key=222";
ASSERT_EQ(OB_INVALID_BACKUP_DEST, info1.set(uri, storage_info));
ASSERT_EQ(OB_SUCCESS, info1.set(uri, storage_info));
info1.reset();
storage_info = "host=xxx.com&access_id=111&access_key=222&s3_region=333";
storage_info = "host=xxx.com&access_id=111&access_key=222&checksum_type=md5&s3_region=333";
ASSERT_EQ(OB_SUCCESS, info1.set(uri, storage_info));
ASSERT_EQ(0, ::strcmp("s3_region=333", info1.extension_));
@ -160,7 +161,7 @@ TEST(ObObjectStorageInfo, s3)
ASSERT_EQ(OB_SUCCESS, info1.get_storage_info_str(buf, sizeof(buf)));
ASSERT_STREQ(storage_info, buf);
storage_info = "host=xxx.com&access_id=111&access_key=222&s3_region=333&delete_mode=delete";
storage_info = "host=xxx.com&access_id=111&access_key=222&checksum_type=md5&s3_region=333&delete_mode=delete";
info1.reset();
ASSERT_EQ(OB_SUCCESS, info1.set(uri, storage_info));
ASSERT_EQ(OB_SUCCESS, info1.get_storage_info_str(buf, sizeof(buf)));