Update test.py

This commit is contained in:
alesapin 2019-05-21 11:15:47 +03:00 committed by GitHub
parent 896e995fe8
commit 09ad1732b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,17 +36,22 @@ def drop_zk(zk):
def test_startup_without_zookeeper(start_cluster): def test_startup_without_zookeeper(start_cluster):
node1.query("INSERT INTO test_table VALUES ('2018-10-01', 1), ('2018-10-02', 2), ('2018-10-03', 3)") node1.query("INSERT INTO test_table VALUES ('2018-10-01', 1), ('2018-10-02', 2), ('2018-10-03', 3)")
assert_eq_with_retry(node1, "SELECT COUNT(*) from test_table", "3\n") assert node1.query("SELECT COUNT(*) from test_table") == "3\n"
assert_eq_with_retry(node1, "SELECT is_readonly from system.replicas where table='test_table'", "0\n") assert node1.query("SELECT is_readonly from system.replicas where table='test_table'") == "0\n"
cluster.run_kazoo_commands_with_retries(drop_zk) cluster.run_kazoo_commands_with_retries(drop_zk)
time.sleep(5) time.sleep(5)
assert_eq_with_retry(node1, "SELECT COUNT(*) from test_table", "3\n") assert node1.query("SELECT COUNT(*) from test_table") == "3\n"
assert_eq_with_retry(node1, "SELECT is_readonly from system.replicas where table='test_table'", "1\n") try:
node1.query("INSERT INTO test_table VALUES ('2018-10-01', 1), ('2018-10-02', 2), ('2018-10-03', 3)")
assert False, "Insert passed without zookeeper"
except:
pass
node1.restart_clickhouse() node1.restart_clickhouse()
time.sleep(5) time.sleep(5)
assert_eq_with_retry(node1, "SELECT COUNT(*) from test_table", "3\n") assert node1.query("SELECT COUNT(*) from test_table") == "3\n"
assert_eq_with_retry(node1, "SELECT is_readonly from system.replicas where table='test_table'", "1\n") assert node1.query("SELECT is_readonly from system.replicas where table='test_table'") == "1\n"