2020-07-13 14:43:05 +00:00
|
|
|
import time
|
|
|
|
import pymysql.cursors
|
|
|
|
import pytest
|
2022-03-22 16:39:58 +00:00
|
|
|
from helpers.cluster import (
|
|
|
|
ClickHouseCluster,
|
|
|
|
ClickHouseInstance,
|
|
|
|
get_docker_compose_path,
|
|
|
|
)
|
2021-02-16 07:10:01 +00:00
|
|
|
import logging
|
2020-07-13 14:43:05 +00:00
|
|
|
|
2023-06-16 07:41:12 +00:00
|
|
|
from . import materialized_with_ddl
|
2020-07-13 14:43:05 +00:00
|
|
|
|
2020-08-13 18:20:47 +00:00
|
|
|
DOCKER_COMPOSE_PATH = get_docker_compose_path()
|
2020-07-17 08:24:21 +00:00
|
|
|
|
2020-07-13 14:43:05 +00:00
|
|
|
cluster = ClickHouseCluster(__file__)
|
2021-02-16 07:10:01 +00:00
|
|
|
mysql_node = None
|
|
|
|
mysql8_node = None
|
2020-12-02 15:29:02 +00:00
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
node_db = cluster.add_instance(
|
|
|
|
"node1",
|
|
|
|
main_configs=["configs/timezone_config.xml"],
|
|
|
|
user_configs=["configs/users.xml"],
|
|
|
|
with_mysql=True,
|
|
|
|
with_mysql8=True,
|
|
|
|
stay_alive=True,
|
|
|
|
)
|
|
|
|
node_disable_bytes_settings = cluster.add_instance(
|
|
|
|
"node2",
|
|
|
|
main_configs=["configs/timezone_config.xml"],
|
|
|
|
user_configs=["configs/users_disable_bytes_settings.xml"],
|
|
|
|
with_mysql=False,
|
|
|
|
stay_alive=True,
|
|
|
|
)
|
|
|
|
node_disable_rows_settings = cluster.add_instance(
|
|
|
|
"node3",
|
|
|
|
main_configs=["configs/timezone_config.xml"],
|
|
|
|
user_configs=["configs/users_disable_rows_settings.xml"],
|
|
|
|
with_mysql=False,
|
|
|
|
stay_alive=True,
|
|
|
|
)
|
2021-11-10 13:13:27 +00:00
|
|
|
|
2020-07-13 14:43:05 +00:00
|
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
|
|
def started_cluster():
|
|
|
|
try:
|
|
|
|
cluster.start()
|
|
|
|
yield cluster
|
|
|
|
finally:
|
2023-07-25 14:19:44 +00:00
|
|
|
node_db.stop_clickhouse() # ensures that coverage report is written to disk, even if cluster.shutdown() times out.
|
2020-07-13 14:43:05 +00:00
|
|
|
cluster.shutdown()
|
|
|
|
|
2020-07-17 08:24:21 +00:00
|
|
|
|
2021-02-16 07:10:01 +00:00
|
|
|
class MySQLConnection:
|
2022-03-22 16:39:58 +00:00
|
|
|
def __init__(
|
|
|
|
self,
|
|
|
|
port,
|
|
|
|
user="root",
|
|
|
|
password="clickhouse",
|
|
|
|
ip_address=None,
|
|
|
|
):
|
2020-07-13 14:43:05 +00:00
|
|
|
self.user = user
|
|
|
|
self.port = port
|
2020-11-10 09:08:12 +00:00
|
|
|
self.ip_address = ip_address
|
2020-07-13 14:43:05 +00:00
|
|
|
self.password = password
|
|
|
|
self.mysql_connection = None # lazy init
|
|
|
|
|
2020-07-17 08:24:21 +00:00
|
|
|
def alloc_connection(self):
|
2021-02-16 07:10:01 +00:00
|
|
|
errors = []
|
|
|
|
for _ in range(5):
|
|
|
|
try:
|
|
|
|
if self.mysql_connection is None:
|
2022-03-22 16:39:58 +00:00
|
|
|
self.mysql_connection = pymysql.connect(
|
|
|
|
user=self.user,
|
|
|
|
password=self.password,
|
|
|
|
host=self.ip_address,
|
|
|
|
port=self.port,
|
|
|
|
autocommit=True,
|
|
|
|
)
|
2021-02-16 07:10:01 +00:00
|
|
|
else:
|
|
|
|
self.mysql_connection.ping(reconnect=True)
|
2022-03-22 16:39:58 +00:00
|
|
|
logging.debug(
|
2023-07-25 14:19:44 +00:00
|
|
|
"MySQL Connection established: {}:{}".format(
|
2022-03-22 16:39:58 +00:00
|
|
|
self.ip_address, self.port
|
|
|
|
)
|
|
|
|
)
|
2021-02-16 07:10:01 +00:00
|
|
|
return self.mysql_connection
|
|
|
|
except Exception as e:
|
|
|
|
errors += [str(e)]
|
|
|
|
time.sleep(1)
|
2023-07-25 14:19:44 +00:00
|
|
|
raise Exception("Connection not established, {}".format(errors))
|
2020-07-17 08:24:21 +00:00
|
|
|
|
|
|
|
def query(self, execution_query):
|
|
|
|
with self.alloc_connection().cursor() as cursor:
|
2020-07-13 14:43:05 +00:00
|
|
|
cursor.execute(execution_query)
|
|
|
|
|
2020-11-11 15:37:44 +00:00
|
|
|
def create_min_priv_user(self, user, password):
|
|
|
|
self.query("CREATE USER '" + user + "'@'%' IDENTIFIED BY '" + password + "'")
|
|
|
|
self.grant_min_priv_for_user(user)
|
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
def grant_min_priv_for_user(self, user, db="priv_err_db"):
|
|
|
|
self.query(
|
|
|
|
"GRANT REPLICATION SLAVE, REPLICATION CLIENT, RELOAD ON *.* TO '"
|
|
|
|
+ user
|
|
|
|
+ "'@'%'"
|
|
|
|
)
|
2020-11-11 15:37:44 +00:00
|
|
|
self.query("GRANT SELECT ON " + db + ".* TO '" + user + "'@'%'")
|
2020-10-30 01:31:45 +00:00
|
|
|
|
2020-10-29 08:09:28 +00:00
|
|
|
def result(self, execution_query):
|
|
|
|
with self.alloc_connection().cursor() as cursor:
|
2020-10-30 01:31:45 +00:00
|
|
|
result = cursor.execute(execution_query)
|
|
|
|
if result is not None:
|
|
|
|
print(cursor.fetchall())
|
2020-10-29 08:09:28 +00:00
|
|
|
|
2023-07-25 14:19:44 +00:00
|
|
|
def query_and_get_data(self, execution_query):
|
2020-11-10 11:31:20 +00:00
|
|
|
with self.alloc_connection().cursor() as cursor:
|
2023-07-25 14:19:44 +00:00
|
|
|
cursor.execute(execution_query)
|
2020-11-10 11:31:20 +00:00
|
|
|
return cursor.fetchall()
|
|
|
|
|
2020-07-13 14:43:05 +00:00
|
|
|
def close(self):
|
|
|
|
if self.mysql_connection is not None:
|
|
|
|
self.mysql_connection.close()
|
|
|
|
|
2021-11-10 13:13:27 +00:00
|
|
|
|
2020-07-17 08:24:21 +00:00
|
|
|
@pytest.fixture(scope="module")
|
|
|
|
def started_mysql_5_7():
|
2022-03-22 16:39:58 +00:00
|
|
|
mysql_node = MySQLConnection(
|
|
|
|
cluster.mysql_port, "root", "clickhouse", cluster.mysql_ip
|
|
|
|
)
|
2021-02-16 07:10:01 +00:00
|
|
|
yield mysql_node
|
2020-07-15 05:26:37 +00:00
|
|
|
|
2021-11-10 13:13:27 +00:00
|
|
|
|
2020-07-18 04:13:41 +00:00
|
|
|
@pytest.fixture(scope="module")
|
|
|
|
def started_mysql_8_0():
|
2022-03-22 16:39:58 +00:00
|
|
|
mysql8_node = MySQLConnection(
|
|
|
|
cluster.mysql8_port, "root", "clickhouse", cluster.mysql8_ip
|
|
|
|
)
|
2021-02-16 07:10:01 +00:00
|
|
|
yield mysql8_node
|
2020-07-18 04:13:41 +00:00
|
|
|
|
2021-11-10 13:13:27 +00:00
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
@pytest.fixture(scope="module")
|
2021-11-10 13:13:27 +00:00
|
|
|
def clickhouse_node():
|
|
|
|
yield node_db
|
|
|
|
|
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
def test_materialized_database_dml_with_mysql_5_7(
|
|
|
|
started_cluster, started_mysql_5_7, clickhouse_node: ClickHouseInstance
|
|
|
|
):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.dml_with_materialized_mysql_database(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_5_7, "mysql57"
|
|
|
|
)
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.materialized_mysql_database_with_views(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_5_7, "mysql57"
|
|
|
|
)
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.materialized_mysql_database_with_datetime_and_decimal(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_5_7, "mysql57"
|
|
|
|
)
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.move_to_prewhere_and_column_filtering(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_5_7, "mysql57"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def test_materialized_database_dml_with_mysql_8_0(
|
|
|
|
started_cluster, started_mysql_8_0, clickhouse_node
|
|
|
|
):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.dml_with_materialized_mysql_database(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.materialized_mysql_database_with_views(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.materialized_mysql_database_with_datetime_and_decimal(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.move_to_prewhere_and_column_filtering(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def test_materialized_database_ddl_with_mysql_5_7(
|
|
|
|
started_cluster, started_mysql_5_7, clickhouse_node
|
|
|
|
):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.drop_table_with_materialized_mysql_database(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_5_7, "mysql57"
|
|
|
|
)
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.create_table_with_materialized_mysql_database(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_5_7, "mysql57"
|
|
|
|
)
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.rename_table_with_materialized_mysql_database(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_5_7, "mysql57"
|
|
|
|
)
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.alter_add_column_with_materialized_mysql_database(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_5_7, "mysql57"
|
|
|
|
)
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.alter_drop_column_with_materialized_mysql_database(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_5_7, "mysql57"
|
|
|
|
)
|
2020-09-15 13:30:30 +00:00
|
|
|
# mysql 5.7 cannot support alter rename column
|
2023-06-16 07:41:12 +00:00
|
|
|
# materialized_with_ddl.alter_rename_column_with_materialized_mysql_database(clickhouse_node, started_mysql_5_7, "mysql57")
|
|
|
|
materialized_with_ddl.alter_rename_table_with_materialized_mysql_database(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_5_7, "mysql57"
|
|
|
|
)
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.alter_modify_column_with_materialized_mysql_database(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_5_7, "mysql57"
|
|
|
|
)
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.create_table_like_with_materialized_mysql_database(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_5_7, "mysql57"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def test_materialized_database_ddl_with_mysql_8_0(
|
|
|
|
started_cluster, started_mysql_8_0, clickhouse_node
|
|
|
|
):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.drop_table_with_materialized_mysql_database(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.create_table_with_materialized_mysql_database(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.rename_table_with_materialized_mysql_database(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.alter_add_column_with_materialized_mysql_database(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.alter_drop_column_with_materialized_mysql_database(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.alter_rename_table_with_materialized_mysql_database(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.alter_rename_column_with_materialized_mysql_database(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.alter_modify_column_with_materialized_mysql_database(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.create_table_like_with_materialized_mysql_database(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def test_materialized_database_ddl_with_empty_transaction_5_7(
|
|
|
|
started_cluster, started_mysql_5_7, clickhouse_node
|
|
|
|
):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.query_event_with_empty_transaction(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_5_7, "mysql57"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def test_materialized_database_ddl_with_empty_transaction_8_0(
|
|
|
|
started_cluster, started_mysql_8_0, clickhouse_node
|
|
|
|
):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.query_event_with_empty_transaction(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2023-07-13 11:27:23 +00:00
|
|
|
def test_text_blob_charset(started_cluster, started_mysql_8_0, clickhouse_node):
|
|
|
|
materialized_with_ddl.text_blob_with_charset_test(
|
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
def test_select_without_columns_5_7(
|
|
|
|
started_cluster, started_mysql_5_7, clickhouse_node
|
|
|
|
):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.select_without_columns(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_5_7, "mysql57"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def test_select_without_columns_8_0(
|
|
|
|
started_cluster, started_mysql_8_0, clickhouse_node
|
|
|
|
):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.select_without_columns(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def test_insert_with_modify_binlog_checksum_5_7(
|
|
|
|
started_cluster, started_mysql_5_7, clickhouse_node
|
|
|
|
):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.insert_with_modify_binlog_checksum(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_5_7, "mysql57"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def test_insert_with_modify_binlog_checksum_8_0(
|
|
|
|
started_cluster, started_mysql_8_0, clickhouse_node
|
|
|
|
):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.insert_with_modify_binlog_checksum(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def test_materialized_database_err_sync_user_privs_5_7(
|
|
|
|
started_cluster, started_mysql_5_7, clickhouse_node
|
|
|
|
):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.err_sync_user_privs_with_materialized_mysql_database(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_5_7, "mysql57"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def test_materialized_database_err_sync_user_privs_8_0(
|
|
|
|
started_cluster, started_mysql_8_0, clickhouse_node
|
|
|
|
):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.err_sync_user_privs_with_materialized_mysql_database(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
2020-10-30 01:31:45 +00:00
|
|
|
|
2021-11-10 13:13:27 +00:00
|
|
|
|
2020-12-02 15:29:02 +00:00
|
|
|
def test_network_partition_5_7(started_cluster, started_mysql_5_7, clickhouse_node):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.network_partition_test(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_5_7, "mysql57"
|
|
|
|
)
|
2020-11-09 09:45:41 +00:00
|
|
|
|
2021-11-10 13:13:27 +00:00
|
|
|
|
2020-12-02 15:29:02 +00:00
|
|
|
def test_network_partition_8_0(started_cluster, started_mysql_8_0, clickhouse_node):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.network_partition_test(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
2020-11-09 09:45:41 +00:00
|
|
|
|
2021-11-10 13:13:27 +00:00
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
def test_mysql_kill_sync_thread_restore_5_7(
|
|
|
|
started_cluster, started_mysql_5_7, clickhouse_node
|
|
|
|
):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.mysql_kill_sync_thread_restore_test(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_5_7, "mysql57"
|
|
|
|
)
|
2020-11-10 11:31:20 +00:00
|
|
|
|
2021-11-10 13:13:27 +00:00
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
def test_mysql_kill_sync_thread_restore_8_0(
|
|
|
|
started_cluster, started_mysql_8_0, clickhouse_node
|
|
|
|
):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.mysql_kill_sync_thread_restore_test(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
2020-11-30 08:38:32 +00:00
|
|
|
|
2021-11-10 13:13:27 +00:00
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
def test_mysql_killed_while_insert_5_7(
|
|
|
|
started_cluster, started_mysql_5_7, clickhouse_node
|
|
|
|
):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.mysql_killed_while_insert(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_5_7, "mysql57"
|
|
|
|
)
|
2020-11-30 08:31:09 +00:00
|
|
|
|
2021-11-10 13:13:27 +00:00
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
def test_mysql_killed_while_insert_8_0(
|
|
|
|
started_cluster, started_mysql_8_0, clickhouse_node
|
|
|
|
):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.mysql_killed_while_insert(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
2020-11-30 08:31:09 +00:00
|
|
|
|
2021-11-10 13:13:27 +00:00
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
def test_clickhouse_killed_while_insert_5_7(
|
|
|
|
started_cluster, started_mysql_5_7, clickhouse_node
|
|
|
|
):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.clickhouse_killed_while_insert(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_5_7, "mysql57"
|
|
|
|
)
|
2020-11-30 08:38:32 +00:00
|
|
|
|
2021-11-10 13:13:27 +00:00
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
def test_clickhouse_killed_while_insert_8_0(
|
|
|
|
started_cluster, started_mysql_8_0, clickhouse_node
|
|
|
|
):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.clickhouse_killed_while_insert(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
2021-01-30 22:37:12 +00:00
|
|
|
|
2021-11-10 13:13:27 +00:00
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
def test_utf8mb4(
|
|
|
|
started_cluster, started_mysql_8_0, started_mysql_5_7, clickhouse_node
|
|
|
|
):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.utf8mb4_test(clickhouse_node, started_mysql_5_7, "mysql57")
|
|
|
|
materialized_with_ddl.utf8mb4_test(clickhouse_node, started_mysql_8_0, "mysql80")
|
2023-07-19 10:53:27 +00:00
|
|
|
materialized_with_ddl.utf8mb4_column_test(
|
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
|
|
|
materialized_with_ddl.utf8mb4_name_test(
|
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
2021-01-28 12:26:47 +00:00
|
|
|
|
2021-11-10 13:13:27 +00:00
|
|
|
|
2021-01-28 12:26:47 +00:00
|
|
|
def test_system_parts_table(started_cluster, started_mysql_8_0, clickhouse_node):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.system_parts_test(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def test_multi_table_update(
|
|
|
|
started_cluster, started_mysql_8_0, started_mysql_5_7, clickhouse_node
|
|
|
|
):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.multi_table_update_test(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_5_7, "mysql57"
|
|
|
|
)
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.multi_table_update_test(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def test_system_tables_table(
|
|
|
|
started_cluster, started_mysql_8_0, started_mysql_5_7, clickhouse_node
|
|
|
|
):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.system_tables_test(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_5_7, "mysql57"
|
|
|
|
)
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.system_tables_test(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def test_materialized_with_column_comments(
|
|
|
|
started_cluster, started_mysql_8_0, started_mysql_5_7, clickhouse_node
|
|
|
|
):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.materialized_with_column_comments_test(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_5_7, "mysql57"
|
|
|
|
)
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.materialized_with_column_comments_test(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2023-07-20 10:24:52 +00:00
|
|
|
def test_double_quoted_comment(started_cluster, started_mysql_8_0, clickhouse_node):
|
|
|
|
materialized_with_ddl.double_quoted_comment(
|
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
def test_materialized_with_enum(
|
|
|
|
started_cluster, started_mysql_8_0, started_mysql_5_7, clickhouse_node
|
|
|
|
):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.materialized_with_enum8_test(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_5_7, "mysql57"
|
|
|
|
)
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.materialized_with_enum16_test(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_5_7, "mysql57"
|
|
|
|
)
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.alter_enum8_to_enum16_test(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_5_7, "mysql57"
|
|
|
|
)
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.materialized_with_enum8_test(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.materialized_with_enum16_test(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.alter_enum8_to_enum16_test(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
|
|
("clickhouse_node"), [node_disable_bytes_settings, node_disable_rows_settings]
|
|
|
|
)
|
|
|
|
def test_mysql_settings(
|
|
|
|
started_cluster, started_mysql_8_0, started_mysql_5_7, clickhouse_node
|
|
|
|
):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.mysql_settings_test(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_5_7, "mysql57"
|
|
|
|
)
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.mysql_settings_test(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def test_large_transaction(
|
|
|
|
started_cluster, started_mysql_8_0, started_mysql_5_7, clickhouse_node
|
|
|
|
):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.materialized_mysql_large_transaction(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.materialized_mysql_large_transaction(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_5_7, "mysql57"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def test_table_table(
|
|
|
|
started_cluster, started_mysql_8_0, started_mysql_5_7, clickhouse_node
|
|
|
|
):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.table_table(clickhouse_node, started_mysql_8_0, "mysql80")
|
|
|
|
materialized_with_ddl.table_table(clickhouse_node, started_mysql_5_7, "mysql57")
|
2021-12-03 09:35:36 +00:00
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
|
|
|
|
def test_table_overrides(
|
|
|
|
started_cluster, started_mysql_8_0, started_mysql_5_7, clickhouse_node
|
|
|
|
):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.table_overrides(clickhouse_node, started_mysql_5_7, "mysql57")
|
|
|
|
materialized_with_ddl.table_overrides(clickhouse_node, started_mysql_8_0, "mysql80")
|
2021-12-17 06:48:49 +00:00
|
|
|
|
2022-03-08 10:17:22 +00:00
|
|
|
|
2022-03-22 16:39:58 +00:00
|
|
|
def test_materialized_database_support_all_kinds_of_mysql_datatype(
|
|
|
|
started_cluster, started_mysql_8_0, started_mysql_5_7, clickhouse_node
|
|
|
|
):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.materialized_database_support_all_kinds_of_mysql_datatype(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.materialized_database_support_all_kinds_of_mysql_datatype(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_5_7, "mysql57"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def test_materialized_database_settings_materialized_mysql_tables_list(
|
|
|
|
started_cluster, started_mysql_8_0, started_mysql_5_7, clickhouse_node
|
|
|
|
):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.materialized_database_settings_materialized_mysql_tables_list(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.materialized_database_settings_materialized_mysql_tables_list(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_5_7, "mysql57"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def test_materialized_database_mysql_date_type_to_date32(
|
|
|
|
started_cluster, started_mysql_8_0, started_mysql_5_7, clickhouse_node
|
|
|
|
):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.materialized_database_mysql_date_type_to_date32(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.materialized_database_mysql_date_type_to_date32(
|
2022-03-22 16:39:58 +00:00
|
|
|
clickhouse_node, started_mysql_5_7, "mysql57"
|
|
|
|
)
|
2022-11-09 12:30:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_savepoint_query(
|
|
|
|
started_cluster, started_mysql_8_0, started_mysql_5_7, clickhouse_node
|
|
|
|
):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.savepoint(clickhouse_node, started_mysql_8_0, "mysql80")
|
|
|
|
materialized_with_ddl.savepoint(clickhouse_node, started_mysql_5_7, "mysql57")
|
2022-11-18 13:29:13 +00:00
|
|
|
|
2022-11-21 03:48:57 +00:00
|
|
|
|
2022-11-18 13:29:13 +00:00
|
|
|
def test_materialized_database_mysql_drop_ddl(
|
|
|
|
started_cluster, started_mysql_8_0, started_mysql_5_7, clickhouse_node
|
|
|
|
):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.dropddl(clickhouse_node, started_mysql_8_0, "mysql80")
|
|
|
|
materialized_with_ddl.dropddl(clickhouse_node, started_mysql_5_7, "mysql57")
|
2023-06-12 11:47:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_named_collections(started_cluster, started_mysql_8_0, clickhouse_node):
|
2023-06-16 07:41:12 +00:00
|
|
|
materialized_with_ddl.named_collections(
|
2023-06-12 11:47:38 +00:00
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|
2023-07-12 15:13:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_create_table_as_select(started_cluster, started_mysql_8_0, clickhouse_node):
|
|
|
|
materialized_with_ddl.create_table_as_select(
|
|
|
|
clickhouse_node, started_mysql_8_0, "mysql80"
|
|
|
|
)
|