Skip to content

Commit

Permalink
Fix fail for --gtest_filter='*StorageDeltaMergeTest*:RegionKVStoreTes…
Browse files Browse the repository at this point in the history
…t.KVStore'
  • Loading branch information
JaySon-Huang committed May 16, 2022
1 parent 2bff33c commit 5427b32
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

#include <limits>

#include "Storages/Transaction/TiDB.h"
#include "dm_basic_include.h"

namespace DB
Expand Down Expand Up @@ -609,6 +610,8 @@ try
sample.insert(DB::tests::createColumn<String>(
Strings(100, "a"),
"col2"));
constexpr TiDB::TableID table_id = 1232;
const String table_name = fmt::format("t_{}", table_id);

Context ctx = DMTestEnv::getContext();
std::shared_ptr<StorageDeltaMerge> storage;
Expand All @@ -631,12 +634,11 @@ try
path.remove(true);

// primary_expr_ast
const String table_name = "t_1233";
ASTPtr astptr(new ASTIdentifier(table_name, ASTIdentifier::Kind::Table));
astptr->children.emplace_back(new ASTIdentifier("col1"));

TiDB::TableInfo tidb_table_info;
tidb_table_info.id = 1;
tidb_table_info.id = table_id;

storage = StorageDeltaMerge::create("TiFlash",
/* db_name= */ "default",
Expand Down Expand Up @@ -692,8 +694,8 @@ try
{
Field res;
c->get(i, res);
ASSERT(!res.isNull());
ASSERT(res.get<Int64>() == 1);
ASSERT_TRUE(!res.isNull());
ASSERT_EQ(res.get<Int64>(), table_id);
}
}
}
Expand Down
23 changes: 20 additions & 3 deletions dbms/src/Storages/Transaction/tests/gtest_kvstore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ RegionPtr makeRegion(UInt64 id, const std::string start_key, const std::string e
class RegionKVStoreTest : public ::testing::Test
{
public:
RegionKVStoreTest()
= default;
RegionKVStoreTest() = default;

static void SetUpTestCase() {}
static void testBasic();
Expand Down Expand Up @@ -1372,12 +1371,30 @@ void RegionKVStoreTest::testBasic()
}
}

TEST_F(RegionKVStoreTest, run)
TEST_F(RegionKVStoreTest, Basic)
try
{
testBasic();
}
CATCH

TEST_F(RegionKVStoreTest, KVStore)
try
{
testKVStore();
}
CATCH

TEST_F(RegionKVStoreTest, Region)
try
{
testRegion();
}
CATCH

TEST_F(RegionKVStoreTest, ReadIndex)
try
{
testReadIndex();
}
CATCH
Expand Down

0 comments on commit 5427b32

Please sign in to comment.