Commit 67e662b9 authored by Jeremy Hylton's avatar Jeremy Hylton

Add single trivial test of monitor server.

Placeholder for more tests.
parent 52913651
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
"""Test that the monitor produce sensible results.
$Id: testMonitor.py,v 1.1 2003/01/09 23:57:43 jeremy Exp $
"""
import socket
import time
import unittest
from ZEO.tests.ConnectionTests import CommonSetupTearDown
class MonitorTests(CommonSetupTearDown):
monitor = 1
def get_monitor_output(self):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('', 42000))
L = []
while 1:
buf = s.recv(8192)
if buf:
L.append(buf)
else:
break
s.close()
return "".join(L)
def getConfig(self, path, create, read_only):
return """\
<Storage>
type MappingStorage
</Storage>
"""
def testMonitor(self):
# just open a client to know that the server is up and running
# XXX should put this in setUp
self.storage = self.openClientStorage()
s = self.get_monitor_output()
self.storage.close()
self.assert_(s.find("monitor") != -1)
def test_suite():
return unittest.makeSuite(MonitorTests)
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