aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorilnaz <ilnaz@ydb.tech>2023-04-26 12:09:33 +0300
committerilnaz <ilnaz@ydb.tech>2023-04-26 12:09:33 +0300
commit7f8bc6caf32ad5a761d92e19f5bbb5e076aece4e (patch)
treead0c14f0434900f697ec828cfe0d1031eaaaa85a
parent508b5c4a49390a28cee508c72a338d3c17755d83 (diff)
downloadydb-7f8bc6caf32ad5a761d92e19f5bbb5e076aece4e.tar.gz
Add EraseRows() test
-rw-r--r--ydb/core/tx/datashard/datashard_ut_erase_rows.cpp28
1 files changed, 25 insertions, 3 deletions
diff --git a/ydb/core/tx/datashard/datashard_ut_erase_rows.cpp b/ydb/core/tx/datashard/datashard_ut_erase_rows.cpp
index 5aa8828080..5304575a2b 100644
--- a/ydb/core/tx/datashard/datashard_ut_erase_rows.cpp
+++ b/ydb/core/tx/datashard/datashard_ut_erase_rows.cpp
@@ -94,8 +94,8 @@ TVector<TString> SerializeKeys(const TVector<ui32>& keys, TKeyCellsMaker makeKey
TProto::TEvEraseRequest MakeEraseRowsRequest(
const TTableId& tableId,
const TVector<ui32>& keyTags,
- const TVector<TString>& keys) {
-
+ const TVector<TString>& keys)
+{
TProto::TEvEraseRequest request;
request.SetTableId(tableId.PathId.LocalPathId);
@@ -180,7 +180,8 @@ private:
void EraseRows(
TServer::TPtr server, const TActorId& sender, const TString& path,
const TTableId& tableId, TVector<ui32> keyTags, TVector<TString> keys,
- ui32 status = TProto::TEvEraseResponse::OK, const TString& error = "") {
+ ui32 status = TProto::TEvEraseResponse::OK, const TString& error = "")
+{
using TEvRequest = TEvDataShard::TEvEraseRowsRequest;
using TEvResponse = TEvDataShard::TEvEraseRowsResponse;
@@ -772,6 +773,27 @@ key = 4, value = (empty maybe)
auto content = ReadShardedTable(server, "/Root/table-1");
UNIT_ASSERT_STRINGS_EQUAL(StripInPlace(content), "key = 3, value = 2030-04-15T00:00:00.000000Z");
}
+
+ Y_UNIT_TEST(EraseRowsFromReplicatedTable) {
+ TPortManager pm;
+ TServerSettings serverSettings(pm.GetPort(2134));
+ serverSettings
+ .SetDomainName("Root")
+ .SetUseRealThreads(false);
+
+ TServer::TPtr server = new TServer(serverSettings);
+ auto& runtime = *server->GetRuntime();
+ const TActorId sender = runtime.AllocateEdgeActor();
+
+ runtime.SetLogPriority(NKikimrServices::TX_DATASHARD, NLog::PRI_DEBUG);
+
+ InitRoot(server, sender);
+ CreateShardedTable(server, sender, "/Root", "table-1", TShardedTableOptions().Replicated(true));
+
+ auto tableId = ResolveTableId(server, sender, "/Root/table-1");
+ EraseRows(server, sender, "/Root/table-1", tableId, {1}, SerializeKeys({1, 2}),
+ TProto::TEvEraseResponse::EXEC_ERROR, "Can't execute erase at replicated table");
+ }
}
Y_UNIT_TEST_SUITE(DistributedEraseTests) {