aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlnaz Nizametdinov <ilnaz@ydb.tech>2024-02-12 21:15:09 +0300
committerGitHub <noreply@github.com>2024-02-12 21:15:09 +0300
commite7c0e8ce51a09e4944589e7bb33a11995e58377f (patch)
tree02ccd9a102647329dca80f5803c133e294793d11
parent9ccad3486059fbc91ec61c43cc9771ca7043f96c (diff)
downloadydb-e7c0e8ce51a09e4944589e7bb33a11995e58377f.tar.gz
Test supported types KIKIMR-20902 (#1865)
-rw-r--r--ydb/core/tx/replication/service/table_writer_ut.cpp59
-rw-r--r--ydb/core/tx/replication/service/ut_table_writer/ya.make1
2 files changed, 60 insertions, 0 deletions
diff --git a/ydb/core/tx/replication/service/table_writer_ut.cpp b/ydb/core/tx/replication/service/table_writer_ut.cpp
index d76a5ccf602..a7eb3fdc8df 100644
--- a/ydb/core/tx/replication/service/table_writer_ut.cpp
+++ b/ydb/core/tx/replication/service/table_writer_ut.cpp
@@ -3,8 +3,11 @@
#include <ydb/core/tx/replication/ut_helpers/test_env.h>
+#include <library/cpp/string_utils/base64/base64.h>
#include <library/cpp/testing/unittest/registar.h>
+#include <util/string/printf.h>
+
namespace NKikimr::NReplication::NService {
Y_UNIT_TEST_SUITE(LocalTableWriter) {
@@ -83,6 +86,62 @@ Y_UNIT_TEST_SUITE(LocalTableWriter) {
TRecord(3, R"({"key":[3], "update":{"value":"30"}})"),
}));
}
+
+ Y_UNIT_TEST(SupportedTypes) {
+ TEnv env;
+ env.GetRuntime().SetLogPriority(NKikimrServices::REPLICATION_SERVICE, NLog::PRI_DEBUG);
+
+ env.CreateTable("/Root", MakeTableDescription(TTestTableDescription{
+ .Name = "Test",
+ .KeyColumns = {"key"},
+ .Columns = {
+ {.Name = "key", .Type = "Uint32"},
+ {.Name = "int32_value", .Type = "Int32"},
+ {.Name = "uint32_value", .Type = "Uint32"},
+ {.Name = "int64_value", .Type = "Int64"},
+ {.Name = "uint64_value", .Type = "Uint64"},
+ {.Name = "uint8_value", .Type = "Uint8"},
+ {.Name = "bool_value", .Type = "Bool"},
+ {.Name = "double_value", .Type = "Double"},
+ {.Name = "float_value", .Type = "Float"},
+ {.Name = "date_value", .Type = "Date"},
+ {.Name = "datetime_value", .Type = "Datetime"},
+ {.Name = "timestamp_value", .Type = "Timestamp"},
+ {.Name = "interval_value", .Type = "Interval"},
+ {.Name = "decimal_value", .Type = "Decimal"},
+ {.Name = "dynumber_value", .Type = "DyNumber"},
+ {.Name = "string_value", .Type = "String"},
+ {.Name = "utf8_value", .Type = "Utf8"},
+ {.Name = "json_value", .Type = "Json"},
+ {.Name = "jsondoc_value", .Type = "JsonDocument"},
+ },
+ }));
+
+ auto writer = env.GetRuntime().Register(CreateLocalTableWriter(GetPathId(env, "/Root/Table")));
+ env.Send<TEvWorker::TEvHandshake>(writer, new TEvWorker::TEvHandshake());
+
+ using TRecord = TEvWorker::TEvData::TRecord;
+ env.Send<TEvWorker::TEvPoll>(writer, new TEvWorker::TEvData({
+ TRecord(1, R"({"key":[1], "update":{"int32_value":-100500}})"),
+ TRecord(2, R"({"key":[2], "update":{"uint32_value":100500}})"),
+ TRecord(3, R"({"key":[3], "update":{"int64_value":-200500}})"),
+ TRecord(4, R"({"key":[4], "update":{"uint64_value":200500}})"),
+ TRecord(5, R"({"key":[5], "update":{"uint8_value":255}})"),
+ TRecord(6, R"({"key":[6], "update":{"bool_value":true}})"),
+ TRecord(7, R"({"key":[7], "update":{"double_value":1.1234}})"),
+ TRecord(8, R"({"key":[8], "update":{"float_value":-1.123}})"),
+ TRecord(9, R"({"key":[9], "update":{"date_value":"2020-08-12T00:00:00.000000Z"}})"),
+ TRecord(10, R"({"key":[10], "update":{"datetime_value":"2020-08-12T12:34:56.000000Z"}})"),
+ TRecord(11, R"({"key":[11], "update":{"timestamp_value":"2020-08-12T12:34:56.123456Z"}})"),
+ TRecord(12, R"({"key":[12], "update":{"interval_value":-300500}})"),
+ TRecord(13, R"({"key":[13], "update":{"decimal_value":"3.321"}})"),
+ TRecord(14, R"({"key":[14], "update":{"dynumber_value":".3321e1"}})"),
+ TRecord(15, Sprintf(R"({"key":[15], "update":{"string_value":"%s"}})", Base64Encode("lorem ipsum").c_str())),
+ TRecord(16, R"({"key":[16], "update":{"utf8_value":"lorem ipsum"}})"),
+ TRecord(17, R"({"key":[17], "update":{"json_value":{"key": "value"}}})"),
+ TRecord(18, R"({"key":[18], "update":{"jsondoc_value":{"key": "value"}}})"),
+ }));
+ }
}
}
diff --git a/ydb/core/tx/replication/service/ut_table_writer/ya.make b/ydb/core/tx/replication/service/ut_table_writer/ya.make
index 9c1d15617d5..60fb05663d4 100644
--- a/ydb/core/tx/replication/service/ut_table_writer/ya.make
+++ b/ydb/core/tx/replication/service/ut_table_writer/ya.make
@@ -8,6 +8,7 @@ TIMEOUT(600)
PEERDIR(
ydb/core/tx/replication/ut_helpers
+ library/cpp/string_utils/base64
library/cpp/testing/unittest
)