diff --git a/docker/test/integration/runner/compose/docker_compose_mysql_5_7_for_materialize_mysql.yml b/docker/test/integration/runner/compose/docker_compose_mysql_5_7_for_materialize_mysql.yml deleted file mode 100644 index e7d762203ee..00000000000 --- a/docker/test/integration/runner/compose/docker_compose_mysql_5_7_for_materialize_mysql.yml +++ /dev/null @@ -1,10 +0,0 @@ -version: '2.3' -services: - mysql1: - image: mysql:5.7 - restart: 'no' - environment: - MYSQL_ROOT_PASSWORD: clickhouse - ports: - - 3308:3306 - command: --server_id=100 --log-bin='mysql-bin-1.log' --default-time-zone='+3:00' --gtid-mode="ON" --enforce-gtid-consistency diff --git a/docker/test/integration/runner/compose/docker_compose_mysql_8_0_for_materialize_mysql.yml b/docker/test/integration/runner/compose/docker_compose_mysql_8_0.yml similarity index 76% rename from docker/test/integration/runner/compose/docker_compose_mysql_8_0_for_materialize_mysql.yml rename to docker/test/integration/runner/compose/docker_compose_mysql_8_0.yml index 918a2b5f80f..7b551371ab2 100644 --- a/docker/test/integration/runner/compose/docker_compose_mysql_8_0_for_materialize_mysql.yml +++ b/docker/test/integration/runner/compose/docker_compose_mysql_8_0.yml @@ -1,10 +1,10 @@ version: '2.3' services: - mysql8_0: + mysql80: image: mysql:8.0 - restart: 'no' + restart: always environment: MYSQL_ROOT_PASSWORD: clickhouse ports: - - 33308:3306 + - ${MYSQL8_EXTERNAL_PORT}:${MYSQL8_INTERNAL_PORT} command: --server_id=100 --log-bin='mysql-bin-1.log' --default_authentication_plugin='mysql_native_password' --default-time-zone='+3:00' --gtid-mode="ON" --enforce-gtid-consistency diff --git a/tests/integration/test_dictionaries_mysql/configs/dictionaries/mysql_dict1.xml b/tests/integration/test_dictionaries_mysql/configs/dictionaries/mysql_dict1.xml index 514c73f3be2..2242088ebc4 100644 --- a/tests/integration/test_dictionaries_mysql/configs/dictionaries/mysql_dict1.xml +++ b/tests/integration/test_dictionaries_mysql/configs/dictionaries/mysql_dict1.xml @@ -5,7 +5,7 @@ test - mysql1 + mysql57 3306 root clickhouse @@ -41,7 +41,7 @@ test - mysql1 + mysql57 3306 root clickhouse diff --git a/tests/integration/test_dictionaries_mysql/configs/dictionaries/mysql_dict2.xml b/tests/integration/test_dictionaries_mysql/configs/dictionaries/mysql_dict2.xml index 91506481cc9..278fad49d03 100644 --- a/tests/integration/test_dictionaries_mysql/configs/dictionaries/mysql_dict2.xml +++ b/tests/integration/test_dictionaries_mysql/configs/dictionaries/mysql_dict2.xml @@ -5,7 +5,7 @@ test - mysql1 + mysql57 3306 root clickhouse @@ -42,7 +42,7 @@ test - mysql1 + mysql57 3306 root clickhouse @@ -78,7 +78,7 @@ test - mysql1 + mysql57 3306 root clickhouse diff --git a/tests/integration/test_dictionaries_mysql/test.py b/tests/integration/test_dictionaries_mysql/test.py index 70af73a1592..90cfe53dd68 100644 --- a/tests/integration/test_dictionaries_mysql/test.py +++ b/tests/integration/test_dictionaries_mysql/test.py @@ -2,6 +2,8 @@ import pymysql.cursors import pytest from helpers.cluster import ClickHouseCluster +import time +import logging CONFIG_FILES = ['configs/dictionaries/mysql_dict1.xml', 'configs/dictionaries/mysql_dict2.xml', 'configs/remote_servers.xml'] @@ -87,11 +89,22 @@ def prepare_mysql_table(table_name, index): # Create CH Dictionary tables based on MySQL tables query(create_clickhouse_dictionary_table_template.format(table_name + str(index), 'dict' + str(index))) - def get_mysql_conn(): - conn = pymysql.connect(user='root', password='clickhouse', host='127.0.0.10', port=cluster.mysql_port) - return conn - + errors = [] + conn = None + for _ in range(5): + try: + if conn is None: + conn = pymysql.connect(user='root', password='clickhouse', host='127.0.0.1', port=cluster.mysql_port) + else: + conn.ping(reconnect=True) + logging.debug("MySQL Connection establised: 127.0.0.1:{}".format(cluster.mysql_port)) + return conn + except Exception as e: + errors += [str(e)] + time.sleep(1) + + raise Exception("Connection not establised, {}".format(errors)) def create_mysql_table(conn, table_name): with conn.cursor() as cursor: