diff options
author | ilnaz <ilnaz@yandex-team.com> | 2024-12-03 13:17:06 +0300 |
---|---|---|
committer | ilnaz <ilnaz@yandex-team.com> | 2024-12-03 13:33:17 +0300 |
commit | 556c8da53b8579d7aceb68fe8fa3513851464a75 (patch) | |
tree | 549beca12e961d2c2fbee142cc6856ae0a22b336 /yql/essentials/sql/v1/sql_ut.cpp | |
parent | 6e7f04fb442b3763c07903c984fed7e40dc0dd5f (diff) | |
download | ydb-556c8da53b8579d7aceb68fe8fa3513851464a75.tar.gz |
New options for ASYNC REPLICATION
commit_hash:7ee0e4b59035ed5c8dedc69e00f95457eca65b88
Diffstat (limited to 'yql/essentials/sql/v1/sql_ut.cpp')
-rw-r--r-- | yql/essentials/sql/v1/sql_ut.cpp | 50 |
1 files changed, 42 insertions, 8 deletions
diff --git a/yql/essentials/sql/v1/sql_ut.cpp b/yql/essentials/sql/v1/sql_ut.cpp index f2cde62e79..e0d243929f 100644 --- a/yql/essentials/sql/v1/sql_ut.cpp +++ b/yql/essentials/sql/v1/sql_ut.cpp @@ -2997,6 +2997,21 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { } } + Y_UNIT_TEST(AsyncReplicationInvalidCommitInterval) { + auto req = R"( + USE plato; + CREATE ASYNC REPLICATION MyReplication + FOR table1 AS table2, table3 AS table4 + WITH ( + COMMIT_INTERVAL = "FOO" + ); + )"; + + auto res = SqlToYql(req); + UNIT_ASSERT(!res.Root); + UNIT_ASSERT_NO_DIFF(Err2Str(res), "<main>:6:35: Error: Literal of Interval type is expected for COMMIT_INTERVAL\n"); + } + Y_UNIT_TEST(AlterAsyncReplicationParseCorrect) { auto req = R"( USE plato; @@ -3026,7 +3041,7 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { UNIT_ASSERT_VALUES_EQUAL(1, elementStat["Write"]); } - Y_UNIT_TEST(AlterAsyncReplicationUnsupportedSettings) { + Y_UNIT_TEST(AlterAsyncReplicationSettings) { auto reqTpl = R"( USE plato; ALTER ASYNC REPLICATION MyReplication @@ -3046,19 +3061,17 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { {"password_secret_name", "bar_secret_name"}, }; - for (const auto& setting : settings) { - auto& key = setting.first; - auto& value = setting.second; - auto req = Sprintf(reqTpl, key.c_str(), value.c_str()); + for (const auto& [k, v] : settings) { + auto req = Sprintf(reqTpl, k.c_str(), v.c_str()); auto res = SqlToYql(req); UNIT_ASSERT(res.Root); - TVerifyLineFunc verifyLine = [&key, &value](const TString& word, const TString& line) { + TVerifyLineFunc verifyLine = [&k, &v](const TString& word, const TString& line) { if (word == "Write") { UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("MyReplication")); UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find("alter")); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(key)); - UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(value)); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(k)); + UNIT_ASSERT_VALUES_UNEQUAL(TString::npos, line.find(v)); } }; @@ -3069,6 +3082,27 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) { } } + Y_UNIT_TEST(AlterAsyncReplicationUnsupportedSettings) { + { + auto req = R"( + USE plato; + ALTER ASYNC REPLICATION MyReplication SET (CONSISTENCY_MODE = "STRONG"); + )"; + auto res = SqlToYql(req); + UNIT_ASSERT(!res.Root); + UNIT_ASSERT_NO_DIFF(Err2Str(res), "<main>:3:79: Error: CONSISTENCY_MODE is not supported in ALTER\n"); + } + { + auto req = R"( + USE plato; + ALTER ASYNC REPLICATION MyReplication SET (COMMIT_INTERVAL = Interval("PT10S")); + )"; + auto res = SqlToYql(req); + UNIT_ASSERT(!res.Root); + UNIT_ASSERT_NO_DIFF(Err2Str(res), "<main>:3:87: Error: COMMIT_INTERVAL is not supported in ALTER\n"); + } + } + Y_UNIT_TEST(AsyncReplicationInvalidSettings) { auto req = R"( USE plato; |