Explicitly set max_connections to 100 for Python test cases to fit Git action MacOS test cases

This commit is contained in:
Aditya Toshniwal 2023-12-25 12:04:10 +05:30
parent cede5cf899
commit 6d399f4fd7
2 changed files with 18 additions and 2 deletions

View File

@ -50,8 +50,23 @@ COVERAGE_CONFIG_FILE = os.path.join(CURRENT_PATH, ".coveragerc")
file_name = os.path.realpath(__file__)
def get_db_connection(db, username, password, host, port, sslmode="prefer"):
def get_db_connection(db, username, password, host, port, sslmode="prefer",
max_connections=None):
"""This function returns the connection object of psycopg"""
if max_connections:
with psycopg.connect(
dbname=db,
user=username,
password=password,
host=host,
port=port,
sslmode=sslmode,
autocommit=True,
) as conn:
cur = conn.cursor()
cur.execute('ALTER SYSTEM SET max_connections TO 100;')
cur.execute('SELECT pg_reload_conf();')
connection = psycopg.connect(
dbname=db,
user=username,

View File

@ -496,7 +496,8 @@ def execute_test(test_module_list_passed, server_passed, driver_passed,
server_passed['db_password'],
server_passed['host'],
server_passed['port'],
server_passed['sslmode']
server_passed['sslmode'],
max_connections=100
)
# Add the server version in server information