Skip to content

Commit f2465cb

Browse files
fix tests (#1653)
* fix tests * fix build
1 parent ed3e338 commit f2465cb

File tree

6 files changed

+42
-16
lines changed

6 files changed

+42
-16
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#include "helper.h"
2+
3+
namespace NKikimr::NOlap::NEngines::NTest {
4+
5+
NKikimrTxColumnShard::TLogicalMetadata TLocalHelper::GetMetaProto() {
6+
NKikimrTxColumnShard::TLogicalMetadata result;
7+
result.SetDirtyWriteTimeSeconds(TInstant::Now().Seconds());
8+
return result;
9+
}
10+
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#pragma once
2+
#include <ydb/core/tx/columnshard/engines/insert_table/meta.h>
3+
4+
namespace NKikimr::NOlap::NEngines::NTest {
5+
6+
class TLocalHelper {
7+
public:
8+
static NKikimrTxColumnShard::TLogicalMetadata GetMetaProto();
9+
};
10+
11+
};

ydb/core/tx/columnshard/engines/ut_insert_table.cpp renamed to ydb/core/tx/columnshard/engines/ut/ut_insert_table.cpp

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
#include "db_wrapper.h"
2-
#include "insert_table/insert_table.h"
1+
#include "helper.h"
2+
#include <ydb/core/tx/columnshard/engines/db_wrapper.h>
3+
#include <ydb/core/tx/columnshard/engines/insert_table/insert_table.h>
34

45
#include <ydb/core/tx/columnshard/columnshard_schema.h>
56

@@ -9,6 +10,7 @@
910
namespace NKikimr {
1011

1112
using namespace NOlap;
13+
using namespace NKikimr::NOlap::NEngines::NTest;
1214

1315
namespace {
1416

@@ -40,7 +42,6 @@ class TTestInsertTableDB: public IDbWrapper {
4042

4143
}
4244

43-
4445
Y_UNIT_TEST_SUITE(TColumnEngineTestInsertTable) {
4546
Y_UNIT_TEST(TestInsertCommit) {
4647
ui64 writeId = 0;
@@ -53,16 +54,16 @@ Y_UNIT_TEST_SUITE(TColumnEngineTestInsertTable) {
5354
ui64 indexSnapshot = 0;
5455

5556
// insert, not commited
56-
bool ok = insertTable.Insert(dbTable, TInsertedData(writeId, tableId, dedupId, blobId1, {}, indexSnapshot, {}));
57+
bool ok = insertTable.Insert(dbTable, TInsertedData(writeId, tableId, dedupId, blobId1, TLocalHelper::GetMetaProto(), indexSnapshot, {}));
5758
UNIT_ASSERT(ok);
5859

5960
// insert the same blobId1 again
60-
ok = insertTable.Insert(dbTable, TInsertedData(writeId, tableId, dedupId, blobId1, {}, indexSnapshot, {}));
61+
ok = insertTable.Insert(dbTable, TInsertedData(writeId, tableId, dedupId, blobId1, TLocalHelper::GetMetaProto(), indexSnapshot, {}));
6162
UNIT_ASSERT(!ok);
6263

6364
// insert different blodId with the same writeId and dedupId
6465
TUnifiedBlobId blobId2(2222, 1, 2, 100, 1);
65-
ok = insertTable.Insert(dbTable, TInsertedData(writeId, tableId, dedupId, blobId2, {}, indexSnapshot, {}));
66+
ok = insertTable.Insert(dbTable, TInsertedData(writeId, tableId, dedupId, blobId2, TLocalHelper::GetMetaProto(), indexSnapshot, {}));
6667
UNIT_ASSERT(!ok);
6768

6869
// read nothing

ydb/core/tx/columnshard/engines/ut_logs_engine.cpp renamed to ydb/core/tx/columnshard/engines/ut/ut_logs_engine.cpp

+11-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
#include "helper.h"
12
#include <library/cpp/testing/unittest/registar.h>
2-
#include "column_engine_logs.h"
3-
#include "predicate/predicate.h"
4-
#include "changes/cleanup.h"
3+
#include <ydb/core/tx/columnshard/engines/column_engine_logs.h>
4+
#include <ydb/core/tx/columnshard/engines/predicate/predicate.h>
5+
#include <ydb/core/tx/columnshard/engines/changes/cleanup.h>
56

67
#include <ydb/core/tx/columnshard/columnshard_ut_common.h>
78
#include <ydb/core/tx/columnshard/engines/changes/compaction.h>
@@ -16,6 +17,7 @@ namespace NTypeIds = NScheme::NTypeIds;
1617
using TTypeId = NScheme::TTypeId;
1718
using TTypeInfo = NScheme::TTypeInfo;
1819
using TDefaultTestsController = NKikimr::NYDBTest::NColumnShard::TController;
20+
using namespace NKikimr::NOlap::NEngines::NTest;
1921

2022
namespace {
2123

@@ -411,8 +413,8 @@ Y_UNIT_TEST_SUITE(TColumnEngineTestLogs) {
411413
engine.Load(db);
412414

413415
std::vector<TInsertedData> dataToIndex = {
414-
TInsertedData(2, paths[0], "", blobRanges[0].BlobId, {}, 0, {}),
415-
TInsertedData(1, paths[0], "", blobRanges[1].BlobId, {}, 0, {})
416+
TInsertedData(2, paths[0], "", blobRanges[0].BlobId, TLocalHelper::GetMetaProto(), 0, {}),
417+
TInsertedData(1, paths[0], "", blobRanges[1].BlobId, TLocalHelper::GetMetaProto(), 0, {})
416418
};
417419

418420
// write
@@ -507,7 +509,7 @@ Y_UNIT_TEST_SUITE(TColumnEngineTestLogs) {
507509
// PlanStep, TxId, PathId, DedupId, BlobId, Data, [Metadata]
508510
std::vector<TInsertedData> dataToIndex;
509511
dataToIndex.push_back(
510-
TInsertedData(txId, pathId, "", blobRange.BlobId, {}, 0, {}));
512+
TInsertedData(txId, pathId, "", blobRange.BlobId, TLocalHelper::GetMetaProto(), 0, {}));
511513

512514
bool ok = Insert(engine, db, TSnapshot(planStep, txId), std::move(dataToIndex), blobs, step);
513515
UNIT_ASSERT(ok);
@@ -605,7 +607,7 @@ Y_UNIT_TEST_SUITE(TColumnEngineTestLogs) {
605607
// PlanStep, TxId, PathId, DedupId, BlobId, Data, [Metadata]
606608
std::vector<TInsertedData> dataToIndex;
607609
dataToIndex.push_back(
608-
TInsertedData(txId, pathId, "", blobRange.BlobId, {}, 0, {}));
610+
TInsertedData(txId, pathId, "", blobRange.BlobId, TLocalHelper::GetMetaProto(), 0, {}));
609611

610612
bool ok = Insert(engine, db, TSnapshot(planStep, txId), std::move(dataToIndex), blobs, step);
611613
for (auto&& i : blobs) {
@@ -639,7 +641,7 @@ Y_UNIT_TEST_SUITE(TColumnEngineTestLogs) {
639641
// PlanStep, TxId, PathId, DedupId, BlobId, Data, [Metadata]
640642
std::vector<TInsertedData> dataToIndex;
641643
dataToIndex.push_back(
642-
TInsertedData(txId, pathId, "", blobRange.BlobId, {}, 0, {}));
644+
TInsertedData(txId, pathId, "", blobRange.BlobId, TLocalHelper::GetMetaProto(), 0, {}));
643645

644646
bool ok = Insert(engine, db, TSnapshot(planStep, txId), std::move(dataToIndex), blobs, step);
645647
UNIT_ASSERT(ok);
@@ -680,7 +682,7 @@ Y_UNIT_TEST_SUITE(TColumnEngineTestLogs) {
680682
// PlanStep, TxId, PathId, DedupId, BlobId, Data, [Metadata]
681683
std::vector<TInsertedData> dataToIndex;
682684
dataToIndex.push_back(
683-
TInsertedData(txId, pathId, "", blobRange.BlobId, {}, 0, {}));
685+
TInsertedData(txId, pathId, "", blobRange.BlobId, TLocalHelper::GetMetaProto(), 0, {}));
684686

685687
bool ok = Insert(engine, db, TSnapshot(planStep, txId), std::move(dataToIndex), blobs, step);
686688
UNIT_ASSERT(ok);

ydb/core/tx/columnshard/engines/ut_program.cpp renamed to ydb/core/tx/columnshard/engines/ut/ut_program.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "index_info.h"
1+
#include <ydb/core/tx/columnshard/engines/index_info.h>
22

33
#include <ydb/core/tx/columnshard/columnshard__index_scan.h>
44
#include <ydb/core/tx/columnshard/columnshard_ut_common.h>

ydb/core/tx/columnshard/engines/ut/ya.make

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ SRCS(
3535
ut_insert_table.cpp
3636
ut_logs_engine.cpp
3737
ut_program.cpp
38+
helper.cpp
3839
ydb/core/tx/columnshard/columnshard_ut_common.cpp
3940
)
4041

0 commit comments

Comments
 (0)