Skip to content

Commit f40ceab

Browse files
danolivokelvich
authored andcommitted
Change create_extension() at bank_client.py: connection string in mtm.init_cluster() is formed in accordance with size of dsns list.
1 parent 4642cb5 commit f40ceab

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/lib/bank_client.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,16 @@ def create_extension(self):
168168
cur.close()
169169
con.close()
170170

171+
connstr = " "
172+
for i in range(len(self.dsns)-1):
173+
connstr = connstr + "\"dbname=regression user=pg host=192.168.253." + str(i+2) + "\""
174+
if (i < len(self.dsns) - 2):
175+
connstr = connstr + ", "
176+
171177
conn = psycopg2.connect(self.dsns[0])
172178
cur = conn.cursor()
173179
cur.execute("select mtm.init_cluster($$%s$$, $${%s}$$);" %
174-
("dbname=regression user=pg host=192.168.253.1",
175-
'"dbname=regression user=pg host=192.168.253.2", "dbname=regression user=pg host=192.168.253.3"'))
180+
("dbname=regression user=pg host=192.168.253.1", connstr))
176181
conn.commit()
177182
cur.close()
178183
conn.close()

0 commit comments

Comments
 (0)