mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +00:00
Fix bool settings parsing in config
This commit is contained in:
parent
7bb387496a
commit
5b4b875497
@ -63,6 +63,17 @@ void SettingNumber<Type>::set(const String & x)
|
||||
set(parse<Type>(x));
|
||||
}
|
||||
|
||||
template <>
|
||||
void SettingNumber<bool>::set(const String & x)
|
||||
{
|
||||
if (x == "false")
|
||||
set(false);
|
||||
else if (x == "true")
|
||||
set(true);
|
||||
else
|
||||
set(parse<bool>(x));
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
void SettingNumber<Type>::serialize(WriteBuffer & buf) const
|
||||
{
|
||||
|
@ -0,0 +1,5 @@
|
||||
<yandex>
|
||||
<merge_tree>
|
||||
<replicated_can_become_leader>false</replicated_can_become_leader>
|
||||
</merge_tree>
|
||||
</yandex>
|
@ -0,0 +1,33 @@
|
||||
import pytest
|
||||
|
||||
from helpers.cluster import ClickHouseCluster
|
||||
|
||||
cluster = ClickHouseCluster(__file__)
|
||||
node1 = cluster.add_instance('node1', main_configs=['configs/notleader.xml'], with_zookeeper=True)
|
||||
node2 = cluster.add_instance('node2', with_zookeeper=True)
|
||||
node3 = cluster.add_instance('node3', with_zookeeper=True)
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def start_cluster():
|
||||
try:
|
||||
cluster.start()
|
||||
|
||||
for i, node in enumerate((node1, node2, node3)):
|
||||
node.query(
|
||||
'''
|
||||
CREATE TABLE test_table(date Date, id UInt32, dummy UInt32)
|
||||
ENGINE = ReplicatedMergeTree('/clickhouse/tables/test_table', '{}')
|
||||
PARTITION BY date ORDER BY id
|
||||
'''.format(i)
|
||||
)
|
||||
|
||||
yield cluster
|
||||
|
||||
finally:
|
||||
cluster.shutdown()
|
||||
|
||||
|
||||
def test_can_become_leader(start_cluster):
|
||||
assert node1.query("select can_become_leader from system.replicas where table = 'test_table'") == '0\n'
|
||||
assert node2.query("select can_become_leader from system.replicas where table = 'test_table'") == '1\n'
|
||||
assert node3.query("select can_become_leader from system.replicas where table = 'test_table'") == '1\n'
|
Loading…
Reference in New Issue
Block a user