From 3ecdad9d4baa0fc4cf3934fc3f170b34e04b5fb4 Mon Sep 17 00:00:00 2001 From: LAL2211 Date: Mon, 4 Apr 2022 14:49:30 -0400 Subject: [PATCH] updated --- tests/integration/helpers/cluster.py | 56 +++++++++++---------- tests/integration/helpers/config_cluster.py | 35 +++++++++++++ 2 files changed, 64 insertions(+), 27 deletions(-) diff --git a/tests/integration/helpers/cluster.py b/tests/integration/helpers/cluster.py index d0b5e892f5b..3a9107d821e 100644 --- a/tests/integration/helpers/cluster.py +++ b/tests/integration/helpers/cluster.py @@ -41,6 +41,8 @@ import docker from .client import Client from .hdfs_api import HDFSApi +from .config_cluster import * + HELPERS_DIR = p.dirname(__file__) CLICKHOUSE_ROOT_DIR = p.join(p.dirname(__file__), "../../..") LOCAL_DOCKER_COMPOSE_DIR = p.join( @@ -1657,8 +1659,8 @@ class ClickHouseCluster: while time.time() - start < timeout: try: conn = pymysql.connect( - user="root", - password="clickhouse", + user=mysql_user, + password=mysql_pass, host=self.mysql_ip, port=self.mysql_port, ) @@ -1679,8 +1681,8 @@ class ClickHouseCluster: while time.time() - start < timeout: try: conn = pymysql.connect( - user="root", - password="clickhouse", + user=mysql8_user, + password=mysql8_pass, host=self.mysql8_ip, port=self.mysql8_port, ) @@ -1704,8 +1706,8 @@ class ClickHouseCluster: try: for ip in [self.mysql2_ip, self.mysql3_ip, self.mysql4_ip]: conn = pymysql.connect( - user="root", - password="clickhouse", + user=mysql_user, + password=mysql_pass, host=ip, port=self.mysql_port, ) @@ -1728,9 +1730,9 @@ class ClickHouseCluster: self.postgres_conn = psycopg2.connect( host=self.postgres_ip, port=self.postgres_port, - database="postgres", - user="postgres", - password="mysecretpassword", + database=pg_db, + user=pg_user, + password=pg_pass, ) self.postgres_conn.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT) self.postgres_conn.autocommit = True @@ -1752,9 +1754,9 @@ class ClickHouseCluster: self.postgres2_conn = psycopg2.connect( host=self.postgres2_ip, port=self.postgres_port, - database="postgres", - user="postgres", - password="mysecretpassword", + database=pg_db, + user=pg_user, + password=pg_pass, ) self.postgres2_conn.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT) self.postgres2_conn.autocommit = True @@ -1768,9 +1770,9 @@ class ClickHouseCluster: self.postgres3_conn = psycopg2.connect( host=self.postgres3_ip, port=self.postgres_port, - database="postgres", - user="postgres", - password="mysecretpassword", + database=pg_db, + user=pg_user, + password=pg_pass, ) self.postgres3_conn.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT) self.postgres3_conn.autocommit = True @@ -1784,9 +1786,9 @@ class ClickHouseCluster: self.postgres4_conn = psycopg2.connect( host=self.postgres4_ip, port=self.postgres_port, - database="postgres", - user="postgres", - password="mysecretpassword", + database=pg_db, + user=pg_user, + password=pg_pass, ) self.postgres4_conn.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT) self.postgres4_conn.autocommit = True @@ -1938,7 +1940,7 @@ class ClickHouseCluster: def wait_mongo_to_start(self, timeout=30, secure=False): connection_str = "mongodb://{user}:{password}@{host}:{port}".format( - host="localhost", port=self.mongo_port, user="root", password="clickhouse" + host="localhost", port=self.mongo_port, user=mongo_user, password=mongo_pass ) if secure: connection_str += "/?tls=true&tlsAllowInvalidCertificates=true" @@ -1962,8 +1964,8 @@ class ClickHouseCluster: ) minio_client = Minio( f"{self.minio_ip}:{self.minio_port}", - access_key="minio", - secret_key="minio123", + access_key=minio_access_key, + secret_key=minio_secret_key, secure=secure, http_client=urllib3.PoolManager(cert_reqs="CERT_NONE"), ) # disable SSL check as we test ClickHouse and not Python library @@ -3481,16 +3483,16 @@ class ClickHouseInstance: "MySQL": { "DSN": "mysql_odbc", "Driver": "/usr/lib/x86_64-linux-gnu/odbc/libmyodbc.so", - "Database": "clickhouse", - "Uid": "root", - "Pwd": "clickhouse", + "Database": odbc_mysql_db, + "Uid": odbc_mysql_uid, + "Pwd": odbc_mysql_pass, "Server": self.cluster.mysql_host, }, "PostgreSQL": { "DSN": "postgresql_odbc", - "Database": "postgres", - "UserName": "postgres", - "Password": "mysecretpassword", + "Database": odbc_psql_db, + "UserName": odbc_psql_user, + "Password": odbc_psql_pass, "Port": str(self.cluster.postgres_port), "Servername": self.cluster.postgres_host, "Protocol": "9.3", diff --git a/tests/integration/helpers/config_cluster.py b/tests/integration/helpers/config_cluster.py index e69de29bb2d..cb4bc6286ff 100644 --- a/tests/integration/helpers/config_cluster.py +++ b/tests/integration/helpers/config_cluster.py @@ -0,0 +1,35 @@ + +# MYSQL CREDENTIALS +mysql_user = 'root' +mysql_pass = 'clickhouse' + + +# MYSQL8 CREDENTIALS +mysql8_user = 'root' +mysql8_pass = 'clickhouse' + +# POSTGRES CREDENTIALS +pg_user = 'postgres' +pg_pass = 'mysecretpassword' +pg_db = 'postgres' + + +# MINIO CREDENTIALS +minio_access_key="minio" +minio_secret_key="minio123" + +# MONGODB CREDENTIALS +mongo_user = 'root' +mongo_pass = 'clickhouse' + +# ODBC CREDENTIALS +odbc_mysql_uid = 'root' +odbc_mysql_pass = 'clickhouse' +odbc_mysql_db = 'clickhouse' + +odbc_psql_db = 'postgres' +odbc_psql_user = 'postgres' +odbc_psql_pass = 'mysecretpassword' + + +