Merge ~adam-collard/maas:faster-unit-tests into maas:master

Proposed by Adam Collard
Status: Merged
Approved by: Adam Collard
Approved revision: 9ddbdf910f484cd5800d2cba8b5c38d92f81522f
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~adam-collard/maas:faster-unit-tests
Merge into: maas:master
Diff against target: 35 lines (+18/-0)
1 file modified
src/maasserver/testing/resources.py (+18/-0)
Reviewer Review Type Date Requested Status
Alberto Donato (community) Approve
MAAS Lander Needs Fixing
Review via email: mp+416520@code.launchpad.net

Commit message

Add go faster stripes to postgresfixture

To post a comment you must log in.
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b faster-unit-tests lp:~adam-collard/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: FAILED
LOG: http://maas-ci.internal:8080/job/maas/job/branch-tester/12027/console
COMMIT: 5eb672d7d65766883ca1c4e525b2a1534f651796

review: Needs Fixing
Revision history for this message
Adam Collard (adam-collard) wrote :

jenkins: !test

Revision history for this message
Alberto Donato (ack) wrote :

nice! +1

a couple of suggestion/nits inline

review: Approve
~adam-collard/maas:faster-unit-tests updated
9ddbdf9... by Adam Collard

[ack's review] dedent, use Path.read_text()

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/maasserver/testing/resources.py b/src/maasserver/testing/resources.py
2index ba8cb7b..8c465b7 100644
3--- a/src/maasserver/testing/resources.py
4+++ b/src/maasserver/testing/resources.py
5@@ -9,6 +9,7 @@ import os
6 from pathlib import Path
7 import re
8 from sys import __stderr__
9+from textwrap import dedent
10
11 from postgresfixture import ClusterFixture
12 import psycopg2
13@@ -47,6 +48,23 @@ class DatabaseClusterManager(TestResourceManager):
14
15 def make(self, dependencies):
16 cluster = ClusterFixture("db", preserve=True)
17+ cluster.create()
18+ postgres_path = Path(cluster.datadir)
19+ postgres_conf = postgres_path / "postgresql.conf"
20+ postgres_speed_conf = postgres_path / "postgresql.conf.speed"
21+ if "postgresql.conf.speed" not in postgres_conf.read_text():
22+ with postgres_conf.open("a") as fh:
23+ fh.write("include = 'postgresql.conf.speed'\n")
24+ with postgres_speed_conf.open("w") as fh:
25+ fh.write(
26+ dedent(
27+ """\
28+ fsync = off
29+ full_page_writes = off
30+ synchronous_commit = off
31+ """
32+ )
33+ )
34 cluster.setUp()
35 return cluster
36

Subscribers

People subscribed via source and target branches