aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgvit <gvit@ydb.tech>2022-11-06 14:48:05 +0300
committergvit <gvit@ydb.tech>2022-11-06 14:48:05 +0300
commitf007166d0bdb3e47d08cab40b4317817ef5f61ce (patch)
tree5cdfe459b2c0505e5d3edbd995e88f496e371885
parentb3d32d35d832324ca498cdd5c84cc7ce261a928a (diff)
downloadydb-f007166d0bdb3e47d08cab40b4317817ef5f61ce.tar.gz
continue switching datashard tests to public api
-rw-r--r--ydb/core/tx/datashard/datashard_ut_erase_rows.cpp22
-rw-r--r--ydb/core/tx/datashard/datashard_ut_upload_rows.cpp20
2 files changed, 12 insertions, 30 deletions
diff --git a/ydb/core/tx/datashard/datashard_ut_erase_rows.cpp b/ydb/core/tx/datashard/datashard_ut_erase_rows.cpp
index 9879c8b2cd..a659a0e87a 100644
--- a/ydb/core/tx/datashard/datashard_ut_erase_rows.cpp
+++ b/ydb/core/tx/datashard/datashard_ut_erase_rows.cpp
@@ -690,15 +690,11 @@ key = 4, value = (empty maybe)
TString txId;
{
- auto ev = ExecRequest(runtime, sender, MakeBeginRequest(sessionId, R"(
+ auto result = KqpSimpleBegin(runtime, sessionId, txId, R"(
SELECT value FROM `/Root/table-1` WHERE key = 1
- )"));
+ )");
- auto& response = ev->Get()->Record.GetRef();
- UNIT_ASSERT_VALUES_EQUAL(response.GetYdbStatus(), Ydb::StatusIds::SUCCESS);
- UNIT_ASSERT_VALUES_EQUAL(response.GetResponse().GetResults().size(), 1);
-
- txId = response.GetResponse().GetTxMeta().id();
+ UNIT_ASSERT_VALUES_EQUAL(result, "{ items { uint64_value: 0 } }");
}
{
@@ -710,17 +706,11 @@ key = 4, value = (empty maybe)
}
{
- auto ev = ExecRequest(runtime, sender, MakeCommitRequest(sessionId, txId, R"(
+ auto result = KqpSimpleCommit(runtime, sessionId, txId, R"(
UPSERT INTO `/Root/table-1` (key, value) VALUES
(4, CAST("2031-04-15T00:00:00.000000Z" AS Timestamp));
- )"));
-
- auto& response = ev->Get()->Record.GetRef();
- UNIT_ASSERT_VALUES_EQUAL(response.GetYdbStatus(), Ydb::StatusIds::ABORTED);
-
- NYql::TIssues issues;
- IssuesFromMessage(response.GetResponse().GetQueryIssues(), issues);
- UNIT_ASSERT(NKqp::HasIssue(issues, NYql::TIssuesIds::KIKIMR_LOCKS_INVALIDATED));
+ )");
+ UNIT_ASSERT_VALUES_EQUAL(result, "ERROR: ABORTED");
}
}
diff --git a/ydb/core/tx/datashard/datashard_ut_upload_rows.cpp b/ydb/core/tx/datashard/datashard_ut_upload_rows.cpp
index c0d8fb3b8a..d770cf0308 100644
--- a/ydb/core/tx/datashard/datashard_ut_upload_rows.cpp
+++ b/ydb/core/tx/datashard/datashard_ut_upload_rows.cpp
@@ -232,12 +232,9 @@ Y_UNIT_TEST_SUITE(TTxDataShardUploadRows) {
// Begin transaction reading key 3
TString txId;
{
- auto ev = ExecRequest(runtime, sender, MakeBeginRequest(sessionId,
- "SELECT value FROM `/Root/table-1` WHERE key = 3"));
- auto& response = ev->Get()->Record.GetRef();
- UNIT_ASSERT_VALUES_EQUAL(response.GetYdbStatus(), Ydb::StatusIds::SUCCESS);
- txId = response.GetResponse().GetTxMeta().id();
- UNIT_ASSERT_VALUES_EQUAL(response.GetResponse().GetResults().size(), 1u);
+ auto result = KqpSimpleBegin(runtime, sessionId, txId,
+ "SELECT value FROM `/Root/table-1` WHERE key = 3");
+ UNIT_ASSERT_VALUES_EQUAL(result, "{ items { uint32_value: 300 } }");
}
// Do some upserts using UploadRows (overwrites key 3)
@@ -249,14 +246,9 @@ Y_UNIT_TEST_SUITE(TTxDataShardUploadRows) {
// Commit transaction and perform some writes (must result in transaction locks invalidated)
{
- auto ev = ExecRequest(runtime, sender, MakeCommitRequest(sessionId, txId,
- "UPSERT INTO `/Root/table-1` (key, value) VALUES (6, 600);"));
- auto& response = ev->Get()->Record.GetRef();
- UNIT_ASSERT_VALUES_EQUAL(response.GetYdbStatus(), Ydb::StatusIds::ABORTED);
-
- NYql::TIssues issues;
- IssuesFromMessage(response.GetResponse().GetQueryIssues(), issues);
- UNIT_ASSERT(NKqp::HasIssue(issues, NYql::TIssuesIds::KIKIMR_LOCKS_INVALIDATED));
+ auto result = KqpSimpleCommit(runtime, sessionId, txId,
+ "UPSERT INTO `/Root/table-1` (key, value) VALUES (6, 600);");
+ UNIT_ASSERT_VALUES_EQUAL(result, "ERROR: ABORTED");
}
}