mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Fix tests
This commit is contained in:
parent
a7e6264d56
commit
4ac090b122
@ -1193,7 +1193,7 @@ TEST_P(CoordinationTest, TestStorageSnapshotSimple)
|
||||
|
||||
EXPECT_EQ(snapshot.snapshot_meta->get_last_log_idx(), 2);
|
||||
EXPECT_EQ(snapshot.session_id, 7);
|
||||
EXPECT_EQ(snapshot.snapshot_container_size, 5);
|
||||
EXPECT_EQ(snapshot.snapshot_container_size, 6);
|
||||
EXPECT_EQ(snapshot.session_and_timeout.size(), 2);
|
||||
|
||||
auto buf = manager.serializeSnapshotToBuffer(snapshot);
|
||||
@ -1205,7 +1205,7 @@ TEST_P(CoordinationTest, TestStorageSnapshotSimple)
|
||||
|
||||
auto [restored_storage, snapshot_meta, _] = manager.deserializeSnapshotFromBuffer(debuf);
|
||||
|
||||
EXPECT_EQ(restored_storage->container.size(), 5);
|
||||
EXPECT_EQ(restored_storage->container.size(), 6);
|
||||
EXPECT_EQ(restored_storage->container.getValue("/").getChildren().size(), 2);
|
||||
EXPECT_EQ(restored_storage->container.getValue("/hello").getChildren().size(), 1);
|
||||
EXPECT_EQ(restored_storage->container.getValue("/hello/somepath").getChildren().size(), 0);
|
||||
@ -1237,14 +1237,14 @@ TEST_P(CoordinationTest, TestStorageSnapshotMoreWrites)
|
||||
|
||||
DB::KeeperStorageSnapshot snapshot(&storage, 50);
|
||||
EXPECT_EQ(snapshot.snapshot_meta->get_last_log_idx(), 50);
|
||||
EXPECT_EQ(snapshot.snapshot_container_size, 53);
|
||||
EXPECT_EQ(snapshot.snapshot_container_size, 54);
|
||||
|
||||
for (size_t i = 50; i < 100; ++i)
|
||||
{
|
||||
addNode(storage, "/hello_" + std::to_string(i), "world_" + std::to_string(i));
|
||||
}
|
||||
|
||||
EXPECT_EQ(storage.container.size(), 103);
|
||||
EXPECT_EQ(storage.container.size(), 104);
|
||||
|
||||
auto buf = manager.serializeSnapshotToBuffer(snapshot);
|
||||
manager.serializeSnapshotBufferToDisk(*buf, 50);
|
||||
@ -1254,7 +1254,7 @@ TEST_P(CoordinationTest, TestStorageSnapshotMoreWrites)
|
||||
auto debuf = manager.deserializeSnapshotBufferFromDisk(50);
|
||||
auto [restored_storage, meta, _] = manager.deserializeSnapshotFromBuffer(debuf);
|
||||
|
||||
EXPECT_EQ(restored_storage->container.size(), 53);
|
||||
EXPECT_EQ(restored_storage->container.size(), 54);
|
||||
for (size_t i = 0; i < 50; ++i)
|
||||
{
|
||||
EXPECT_EQ(restored_storage->container.getValue("/hello_" + std::to_string(i)).getData(), "world_" + std::to_string(i));
|
||||
@ -1293,7 +1293,7 @@ TEST_P(CoordinationTest, TestStorageSnapshotManySnapshots)
|
||||
|
||||
auto [restored_storage, meta, _] = manager.restoreFromLatestSnapshot();
|
||||
|
||||
EXPECT_EQ(restored_storage->container.size(), 253);
|
||||
EXPECT_EQ(restored_storage->container.size(), 254);
|
||||
|
||||
for (size_t i = 0; i < 250; ++i)
|
||||
{
|
||||
@ -1327,16 +1327,16 @@ TEST_P(CoordinationTest, TestStorageSnapshotMode)
|
||||
if (i % 2 == 0)
|
||||
storage.container.erase("/hello_" + std::to_string(i));
|
||||
}
|
||||
EXPECT_EQ(storage.container.size(), 28);
|
||||
EXPECT_EQ(storage.container.snapshotSizeWithVersion().first, 104);
|
||||
EXPECT_EQ(storage.container.size(), 29);
|
||||
EXPECT_EQ(storage.container.snapshotSizeWithVersion().first, 105);
|
||||
EXPECT_EQ(storage.container.snapshotSizeWithVersion().second, 1);
|
||||
auto buf = manager.serializeSnapshotToBuffer(snapshot);
|
||||
manager.serializeSnapshotBufferToDisk(*buf, 50);
|
||||
}
|
||||
EXPECT_TRUE(fs::exists("./snapshots/snapshot_50.bin" + params.extension));
|
||||
EXPECT_EQ(storage.container.size(), 28);
|
||||
EXPECT_EQ(storage.container.size(), 29);
|
||||
storage.clearGarbageAfterSnapshot();
|
||||
EXPECT_EQ(storage.container.snapshotSizeWithVersion().first, 28);
|
||||
EXPECT_EQ(storage.container.snapshotSizeWithVersion().first, 29);
|
||||
for (size_t i = 0; i < 50; ++i)
|
||||
{
|
||||
if (i % 2 != 0)
|
||||
@ -1865,7 +1865,7 @@ TEST_P(CoordinationTest, TestStorageSnapshotDifferentCompressions)
|
||||
|
||||
auto [restored_storage, snapshot_meta, _] = new_manager.deserializeSnapshotFromBuffer(debuf);
|
||||
|
||||
EXPECT_EQ(restored_storage->container.size(), 5);
|
||||
EXPECT_EQ(restored_storage->container.size(), 6);
|
||||
EXPECT_EQ(restored_storage->container.getValue("/").getChildren().size(), 2);
|
||||
EXPECT_EQ(restored_storage->container.getValue("/hello").getChildren().size(), 1);
|
||||
EXPECT_EQ(restored_storage->container.getValue("/hello/somepath").getChildren().size(), 0);
|
||||
|
@ -31,7 +31,7 @@ void StorageSystemZooKeeperConnection::fillData(MutableColumns & res_columns, Co
|
||||
res_columns[3]->insert(context->getZooKeeper()->getConnectedZooKeeperIndex());
|
||||
res_columns[4]->insert(context->getZooKeeperSessionUptime());
|
||||
res_columns[5]->insert(context->getZooKeeper()->expired());
|
||||
res_columns[6]->insert(static_cast<uint8_t>(KeeperApiVersion::WITH_MULTI_READ));
|
||||
res_columns[6]->insert(0);
|
||||
res_columns[7]->insert(context->getZooKeeper()->getClientID());
|
||||
|
||||
for (const auto & elem : context->getAuxiliaryZooKeepers())
|
||||
@ -42,7 +42,7 @@ void StorageSystemZooKeeperConnection::fillData(MutableColumns & res_columns, Co
|
||||
res_columns[3]->insert(elem.second->getConnectedZooKeeperIndex());
|
||||
res_columns[4]->insert(elem.second->getSessionUptime());
|
||||
res_columns[5]->insert(elem.second->expired());
|
||||
res_columns[6]->insert(static_cast<uint8_t>(KeeperApiVersion::WITH_MULTI_READ));
|
||||
res_columns[6]->insert(0);
|
||||
res_columns[7]->insert(elem.second->getClientID());
|
||||
}
|
||||
|
||||
|
@ -28,5 +28,9 @@
|
||||
<port>9234</port>
|
||||
</server>
|
||||
</raft_configuration>
|
||||
|
||||
<feature_flags>
|
||||
<check_not_exists>1</check_not_exists>
|
||||
</feature_flags>
|
||||
</keeper_server>
|
||||
</clickhouse>
|
||||
|
@ -183,8 +183,8 @@ def test_cmd_mntr(started_cluster):
|
||||
# contains:
|
||||
# 10 nodes created by test
|
||||
# 3 nodes created by clickhouse "/clickhouse/task_queue/ddl"
|
||||
# 1 root node, 2 keeper system nodes
|
||||
assert int(result["zk_znode_count"]) == 13
|
||||
# 1 root node, 3 keeper system nodes
|
||||
assert int(result["zk_znode_count"]) == 14
|
||||
assert int(result["zk_watch_count"]) == 2
|
||||
assert int(result["zk_ephemerals_count"]) == 2
|
||||
assert int(result["zk_approximate_data_size"]) > 0
|
||||
@ -329,7 +329,7 @@ def test_cmd_srvr(started_cluster):
|
||||
assert int(result["Connections"]) == 1
|
||||
assert int(result["Zxid"]) > 10
|
||||
assert result["Mode"] == "leader"
|
||||
assert result["Node count"] == "13"
|
||||
assert result["Node count"] == "14"
|
||||
|
||||
finally:
|
||||
destroy_zk_client(zk)
|
||||
@ -369,7 +369,7 @@ def test_cmd_stat(started_cluster):
|
||||
assert int(result["Connections"]) == 1
|
||||
assert int(result["Zxid"]) >= 10
|
||||
assert result["Mode"] == "leader"
|
||||
assert result["Node count"] == "13"
|
||||
assert result["Node count"] == "14"
|
||||
|
||||
# filter connection statistics
|
||||
cons = [n for n in data.split("\n") if "=" in n]
|
||||
|
@ -1,2 +1,2 @@
|
||||
default ::1 9181 0 0 3
|
||||
default ::1 9181 0 0 0
|
||||
zookeeper2 ::1 9181 0 0 0
|
||||
|
Loading…
Reference in New Issue
Block a user