Merge pull request #35936 from DevTeamBK/MARIANA-62

Move credentials for integration tests into a separate file (The ticket name in IBM's JIRA is MARIANA-62)
This commit is contained in:
Alexey Milovidov 2022-04-06 03:27:27 +03:00 committed by GitHub
commit bad2e9dc06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 60 additions and 27 deletions

View File

@ -48,6 +48,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(
@ -1664,8 +1666,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,
)
@ -1686,8 +1688,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,
)
@ -1711,8 +1713,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,
)
@ -1735,9 +1737,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
@ -1759,9 +1761,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
@ -1775,9 +1777,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
@ -1791,9 +1793,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
@ -1945,7 +1947,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"
@ -1969,8 +1971,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
@ -3488,16 +3490,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",

View File

@ -0,0 +1,31 @@
# 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"