Skip to content

Commit 5dbeaf5

Browse files
committedOct 29, 2017
[postgres][test] Check QgsFeatureRequest.connectionTimeout flag
1 parent 29e8990 commit 5dbeaf5

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
 

‎tests/src/python/test_provider_postgres.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,18 @@ def testNestedInsert(self):
339339
self.vl.addFeature(f) # Should not deadlock during an active iteration
340340
f = next(it)
341341

342+
def testTimeout(self):
343+
"""
344+
Asserts that we will not deadlock if more iterators are opened in parallel than
345+
available in the connection pool
346+
"""
347+
request = QgsFeatureRequest()
348+
request.setConnectionTimeout(1)
349+
350+
iterators = list()
351+
for i in range(100):
352+
iterators.append(self.vl.getFeatures(request))
353+
342354
def testTransactionNotDirty(self):
343355
# create a vector ayer based on postgres
344356
vl = QgsVectorLayer(self.dbconn + ' sslmode=disable key=\'pk\' srid=4326 type=POLYGON table="qgis_test"."some_poly_data" (geom) sql=', 'test', 'postgres')

0 commit comments

Comments
 (0)
Please sign in to comment.