Commit 2491c9b3 authored by Jeremy Hylton's avatar Jeremy Hylton

Add option to enable monitor server.

parent 3a8228b0
......@@ -61,6 +61,7 @@ class CommonSetupTearDown(StorageTestBase):
keep = 0
invq = None
timeout = None
monitor = 0
def setUp(self):
"""Test setup for connection tests.
......@@ -132,7 +133,8 @@ class CommonSetupTearDown(StorageTestBase):
path = "%s.%d" % (self.file, index)
conf = self.getConfig(path, create, read_only)
zeoport, adminaddr, pid = forker.start_zeo_server(
conf, addr, ro_svr, self.keep, self.invq, self.timeout)
conf, addr, ro_svr,
self.monitor, self.keep, self.invq, self.timeout)
self._pids.append(pid)
self._servers.append(adminaddr)
......
......@@ -51,7 +51,7 @@ def get_port():
raise RuntimeError, "Can't find port"
def start_zeo_server(conf, addr=None, ro_svr=0, keep=0, invq=None,
def start_zeo_server(conf, addr=None, ro_svr=0, monitor=0, keep=0, invq=None,
timeout=None):
"""Start a ZEO server in a separate process.
......@@ -82,6 +82,9 @@ def start_zeo_server(conf, addr=None, ro_svr=0, keep=0, invq=None,
args += ['-Q', str(invq)]
if timeout:
args += ['-T', str(timeout)]
if monitor:
# XXX Is it safe to reuse the port?
args += ['-m', '42000']
args.append(str(port))
d = os.environ.copy()
d['PYTHONPATH'] = os.pathsep.join(sys.path)
......
......@@ -135,8 +135,9 @@ def main():
configfile = None
invalidation_queue_size = 100
transaction_timeout = None
monitor_address = None
# Parse the arguments and let getopt.error percolate
opts, args = getopt.getopt(sys.argv[1:], 'rkC:Q:T:')
opts, args = getopt.getopt(sys.argv[1:], 'rkC:Q:T:m:')
for opt, arg in opts:
if opt == '-r':
ro_svr = 1
......@@ -148,6 +149,8 @@ def main():
invalidation_queue_size = int(arg)
elif opt == '-T':
transaction_timeout = int(arg)
elif opt == "-m":
monitor_address = '', int(arg)
# Open the config file and let ZConfig parse the data there. Then remove
# the config file, otherwise we'll leave turds.
fp = open(configfile, 'r')
......@@ -163,7 +166,8 @@ def main():
serv = ZEO.StorageServer.StorageServer(
addr, {'1': storage}, ro_svr,
invalidation_queue_size=invalidation_queue_size,
transaction_timeout=transaction_timeout)
transaction_timeout=transaction_timeout,
monitor_address=monitor_address)
try:
log(label, 'creating the test server, ro: %s, keep: %s', ro_svr, keep)
t = ZEOTestServer(test_addr, serv, keep)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment