test case correction to add connection close in test step
as DB connection was notting closed, some tests are getting hung because locks were not released.
@@ -3272,6 +3272,7 @@ def impl(context, config_file):
def step_impl(context):
query = "select dbid, port, hostname, datadir from gp_segment_configuration where content >= 0"
conn = dbconn.connect(dbconn.DbURL(dbname='postgres'), unsetSearchPath=False)
+ try:
segments = dbconn.query(conn, query).fetchall()
for segment in segments:
dbid = "'%s'" % segment[0]
@@ -3290,6 +3291,9 @@ def step_impl(context):
if str(dic['port']) != port:
raise Exception("port value in postgresql.conf of %s is incorrect. Expected:%s, given:%s" %
(hostname, port, dic['port']))
+ finally:
+ if conn:
+ conn.close()
@given('the transactions are started for dml')
def impl(context):
