Hello Milimetric,
I'd like you to do a code review. Please visit
https://gerrit.wikimedia.org/r/149303
to review the following change.
Change subject: Put focus on last connection in connection pool test
......................................................................
Put focus on last connection in connection pool test
Change-Id: Iae4202594d27fdcd006978908bd2ad6e90c8712a
---
M tests/test_database/test_connection_pool_configuration.py
1 file changed, 13 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/analytics/wikimetrics
refs/changes/03/149303/1
diff --git a/tests/test_database/test_connection_pool_configuration.py
b/tests/test_database/test_connection_pool_configuration.py
index 26dcc73..9a7deec 100644
--- a/tests/test_database/test_connection_pool_configuration.py
+++ b/tests/test_database/test_connection_pool_configuration.py
@@ -1,7 +1,6 @@
from unittest import TestCase
from sqlalchemy.exc import TimeoutError
from nose.plugins.attrib import attr
-from nose.tools import raises
from tests.fixtures import mediawiki_project
from wikimetrics.configurables import db, parse_db_connection_string, queue
@@ -12,7 +11,6 @@
class DatabaseSetupTest(TestCase):
@attr('slow')
- @raises(TimeoutError)
def test_pool_size_can_be_exceeded(self):
# The 11 in the following statement is 10 (default for
# max_overflow) + 1. So this is the lowest value for which we
@@ -22,7 +20,19 @@
db.get_mw_session(mediawiki_project)
for i in range(pool_size)
]
- [self.sessions[i].query(Page).first() for i in range(pool_size)]
+ [self.sessions[i].query(Page).first() for i in range(pool_size - 1)]
+
+ try:
+ self.sessions[-1].query(Page).first()
+
+ # We should never reach this, as the opening the
+ # connection for the above statement should fail.
+ self.fail("Final connection succeeded.")
+ except TimeoutError:
+ # The TimeoutError is expected, as it is above the limit
+ # of open connections in the pool.
+ pass
+
def test_pool_size_is_used(self):
pool_size = db.config['MEDIAWIKI_POOL_SIZE']
--
To view, visit https://gerrit.wikimedia.org/r/149303
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iae4202594d27fdcd006978908bd2ad6e90c8712a
Gerrit-PatchSet: 1
Gerrit-Project: analytics/wikimetrics
Gerrit-Branch: master
Gerrit-Owner: QChris <[email protected]>
Gerrit-Reviewer: Milimetric <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits