forked from ydb-platform/ydb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix parsing of s3 settings on CS (ydb-platform#12856)
- Loading branch information
1 parent
3e06721
commit d0eec48
Showing
3 changed files
with
88 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#include <ydb/core/tx/tiering/tier/object.h> | ||
|
||
#include <library/cpp/testing/unittest/registar.h> | ||
|
||
namespace NKikimr { | ||
|
||
using namespace NColumnShard; | ||
|
||
Y_UNIT_TEST_SUITE(S3SettingsConvertion) { | ||
void ValidateConversion( | ||
const NKikimrSchemeOp::TExternalDataSourceDescription& input, TConclusion<const NKikimrSchemeOp::TS3Settings> expectedResult) { | ||
NTiers::TTierConfig config; | ||
TConclusionStatus status = config.DeserializeFromProto(input); | ||
if (expectedResult.IsFail()) { | ||
UNIT_ASSERT(status.IsFail()); | ||
UNIT_ASSERT_VALUES_EQUAL(expectedResult.GetErrorMessage(), status.GetErrorMessage()); | ||
} else { | ||
UNIT_ASSERT(status.IsSuccess()); | ||
UNIT_ASSERT_VALUES_EQUAL(expectedResult->DebugString(), config.GetProtoConfig().DebugString()); | ||
} | ||
} | ||
|
||
Y_UNIT_TEST(Basic) { | ||
NKikimrSchemeOp::TExternalDataSourceDescription input; | ||
UNIT_ASSERT(google::protobuf::TextFormat::ParseFromString(R"( | ||
SourceType: "ObjectStorage" | ||
Location: "http://storage.yandexcloud.net/my-bucket" | ||
Auth { | ||
Aws { | ||
AwsAccessKeyIdSecretName: "access-key" | ||
AwsSecretAccessKeySecretName: "secret-key" | ||
AwsRegion: "ru-central1" | ||
} | ||
} | ||
)", &input)); | ||
NKikimrSchemeOp::TS3Settings output; | ||
UNIT_ASSERT(google::protobuf::TextFormat::ParseFromString(R"( | ||
Scheme: HTTP | ||
Endpoint: "storage.yandexcloud.net" | ||
Bucket: "my-bucket" | ||
SecretKey: "SId:secret-key" | ||
AccessKey: "SId:access-key" | ||
Region: "ru-central1" | ||
)", &output)); | ||
ValidateConversion(input, output); | ||
} | ||
|
||
Y_UNIT_TEST(Port) { | ||
NKikimrSchemeOp::TExternalDataSourceDescription input; | ||
UNIT_ASSERT(google::protobuf::TextFormat::ParseFromString(R"( | ||
SourceType: "ObjectStorage" | ||
Location: "http://storage.yandexcloud.net:12345/my-bucket" | ||
Auth { | ||
Aws { | ||
AwsAccessKeyIdSecretName: "access-key" | ||
AwsSecretAccessKeySecretName: "secret-key" | ||
AwsRegion: "ru-central1" | ||
} | ||
} | ||
)", &input)); | ||
NKikimrSchemeOp::TS3Settings output; | ||
UNIT_ASSERT(google::protobuf::TextFormat::ParseFromString(R"( | ||
Scheme: HTTP | ||
Endpoint: "storage.yandexcloud.net:12345" | ||
Bucket: "my-bucket" | ||
SecretKey: "SId:secret-key" | ||
AccessKey: "SId:access-key" | ||
Region: "ru-central1" | ||
)", &output)); | ||
ValidateConversion(input, output); | ||
} | ||
} | ||
|
||
} // namespace NKikimr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ YQL_LAST_ABI_VERSION() | |
|
||
SRCS( | ||
ut_tiers.cpp | ||
ut_object.cpp | ||
) | ||
|
||
END() |