launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #19516
[Merge] lp:~wgrant/launchpad/af-unix-testsuite into lp:launchpad
William Grant has proposed merging lp:~wgrant/launchpad/af-unix-testsuite into lp:launchpad.
Commit message:
Switch the test suite from TCP to UNIX PostgreSQL connections, avoiding >60ms of setup time per test.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~wgrant/launchpad/af-unix-testsuite/+merge/273159
Switch the test suite from TCP to UNIX PostgreSQL connections, avoiding >60ms of setup time per test.
The test suite loves to reconnect to PostgreSQL a few times for each test. On my desktop, a TCP connection takes ~17ms while a UNIX domain socket takes <2ms. With a few ~15ms wins across 20000 tests, that's quite an improvement.
pgbouncer doesn't love UNIX sockets, so PGBouncerFixture sets PGHOST to force TCP.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/af-unix-testsuite into lp:launchpad.
=== modified file 'configs/testrunner/launchpad-lazr.conf'
--- configs/testrunner/launchpad-lazr.conf 2015-09-26 16:32:29 +0000
+++ configs/testrunner/launchpad-lazr.conf 2015-10-02 00:19:49 +0000
@@ -24,8 +24,8 @@
internal_branch_by_id_root: file:///var/tmp/bazaar.launchpad.dev/mirrors
[database]
-rw_main_master: dbname=launchpad_ftest host=localhost
-rw_main_slave: dbname=launchpad_ftest host=localhost
+rw_main_master: dbname=launchpad_ftest
+rw_main_slave: dbname=launchpad_ftest
[error_reports]
oops_prefix: T
=== modified file 'lib/lp/services/config/doc/canonical-config.txt'
--- lib/lp/services/config/doc/canonical-config.txt 2012-02-28 05:36:01 +0000
+++ lib/lp/services/config/doc/canonical-config.txt 2015-10-02 00:19:49 +0000
@@ -17,8 +17,7 @@
>>> from lp.services.config import config
>>> from lp.testing.layers import DatabaseLayer
- >>> expected = (
- ... 'dbname=%s host=localhost' % DatabaseLayer._db_fixture.dbname)
+ >>> expected = 'dbname=%s' % DatabaseLayer._db_fixture.dbname
>>> expected == config.database.rw_main_master
True
=== modified file 'lib/lp/testing/fixture.py'
--- lib/lp/testing/fixture.py 2015-06-12 17:50:34 +0000
+++ lib/lp/testing/fixture.py 2015-10-02 00:19:49 +0000
@@ -113,6 +113,7 @@
# via pgbouncer. Otherwise, we would need to temporarily
# overwrite the database connection strings in the config.
self.useFixture(EnvironmentVariableFixture('PGPORT', str(self.port)))
+ self.useFixture(EnvironmentVariableFixture('PGHOST', 'localhost'))
# Reset database connections so they go through pgbouncer.
self._maybe_reconnect_stores()
=== modified file 'lib/lp/testing/pgsql.py'
--- lib/lp/testing/pgsql.py 2014-01-15 10:46:59 +0000
+++ lib/lp/testing/pgsql.py 2015-10-02 00:19:49 +0000
@@ -196,8 +196,8 @@
# available.
# Avoid circular imports
section = """[database]
-rw_main_master: dbname=%s host=localhost
-rw_main_slave: dbname=%s host=localhost
+rw_main_master: dbname=%s
+rw_main_slave: dbname=%s
""" % (self.dbname, self.dbname)
if BaseLayer.config_fixture is not None:
=== modified file 'lib/lp/testing/tests/test_pgsql.py'
--- lib/lp/testing/tests/test_pgsql.py 2012-04-19 10:53:54 +0000
+++ lib/lp/testing/tests/test_pgsql.py 2015-10-02 00:19:49 +0000
@@ -52,7 +52,7 @@
fixture.setUp()
self.addCleanup(fixture.dropDb)
self.addCleanup(fixture.tearDown)
- expected_value = 'dbname=%s host=localhost' % fixture.dbname
+ expected_value = 'dbname=%s' % fixture.dbname
self.assertEqual(expected_value, dbconfig.rw_main_master)
self.assertEqual(expected_value, dbconfig.rw_main_slave)
with ConfigUseFixture(BaseLayer.appserver_config_name):
Follow ups