Merge lp:~hazmat/pyjuju/test-sans-fsync into lp:pyjuju
Proposed by
Kapil Thangavelu
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Approved by: | Kapil Thangavelu | ||||||||
Approved revision: | 544 | ||||||||
Merged at revision: | 545 | ||||||||
Proposed branch: | lp:~hazmat/pyjuju/test-sans-fsync | ||||||||
Merge into: | lp:pyjuju | ||||||||
Diff against target: |
56 lines (+9/-5) 2 files modified
juju/lib/zk.py (+6/-3) juju/tests/common.py (+3/-2) |
||||||||
To merge this branch: | bzr merge lp:~hazmat/pyjuju/test-sans-fsync | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Clint Byrum (community) | Approve | ||
Benjamin Saller (community) | Approve | ||
Review via email: mp+112188@code.launchpad.net |
Description of the change
disable fsync on zk to speed tests.
[r=bcsaller,
The tests exercise zk heavily, and by defaults its configured
for per operation fsync to disk, disabling the fsync greatly
speeds up full test runs.
To post a comment you must log in.
Reviewers: mp+112188_ code.launchpad. net,
Message:
Please take a look.
Description:
Disable fsync on zk to speed tests.
The tests exercise zk heavily, and by defaults its configured
for per operation fsync to disk, disabling the fsync greatly
speeds up full test runs.
https:/ /code.launchpad .net/~hazmat/ juju/test- sans-fsync/ +merge/ 112188
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/6331066/
Affected files: common. py
A [revision details]
M juju/lib/zk.py
M juju/tests/
Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: <email address hidden>
+New revision: <email address hidden>
Index: juju/lib/zk.py
=== modified file 'juju/lib/zk.py'
--- juju/lib/zk.py 2011-09-22 19:32:36 +0000
+++ juju/lib/zk.py 2012-06-26 16:36:32 +0000
@@ -51,7 +51,7 @@
def __init__(self, run_dir, port=None, host=None,
zk_ location= "system" , user=None, group=None,
self. _group = group
self. _zk_location = zk_location
self. _use_deferred = use_deferred
- use_deferred=True):
+ use_deferred=True, fsync=True):
"""
:param run_dir: Directory to store all zookeeper instance related
data.
:param port: The port zookeeper should run on.
@@ -73,6 +73,7 @@
+ self.fsync = fsync
def start(self):
config. write(log4j_ properties)
assert self._port is not None
@@ -197,8 +198,10 @@
with open(zk_ vars["config_ path"], "w") as config: conf_template % (zk_vars[ "data_dir" ], conf_template % (zk_vars[ "data_dir" ],
config. write(" \nclientPortAdd ress=%s" % self._host)
- config.write(
- zookeeper_
self._port))
+ conf = zookeeper_
self._port)
+ if self.fsync:
+ conf += "\nfsync=no\n"
+ config.write(conf)
if self._host:
Index: juju/tests/ common. py common. py' common. py 2011-09-16 00:36:31 +0000 common. py 2012-06-26 16:36:32 +0000
=== modified file 'juju/tests/
--- juju/tests/
+++ juju/tests/
@@ -23,7 +23,7 @@
@contextmanager test_context( install_ path, port=28181): test_context( install_ path, port=28181, fsync=False):
-def zookeeper_
+def zookeeper_
"""Manage context to run/stop a ZooKeeper for testing and related vars.
@param install_path: The path to the install for ZK. Bare word "system" get("ZOOKEEPER_ ADDRESS" ) zookeeper = Zookeeper(
tempfile. mkdtemp( ), port, install_ path, use_deferred=False) install_ path, use_deferred=False,
@@ -36,7 +36,8 @@
saved_env = os.environ.
test_
- zk_location=
+ zk_location=
+ fsync=fsync)
test_ zookeeper. start() environ[ "ZOOKEEPER_ ADDRESS" ] = test_zookeeper. address
os.