~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_serve.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-12-18 23:21:58 UTC
  • mfrom: (4911.1.2 jam-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20091218232158-sc5b6z2upfgjf30u
(jam) Fix for -Dhpss server side. Threads don't have .get_ident(),
        and py2.4/2.5 don't have .ident, fallback to .getName()

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
from bzrlib import (
29
29
    builtins,
 
30
    debug,
30
31
    errors,
31
32
    osutils,
32
33
    revision as _mod_revision,
45
46
from bzrlib.trace import mutter
46
47
from bzrlib.transport import get_transport, remote
47
48
 
 
49
 
48
50
class TestBzrServeBase(TestCaseWithTransport):
49
51
 
50
52
    def run_bzr_serve_then_func(self, serve_args, retcode=0, func=None,
130
132
            finish_bzr_subprocess, a client for the server, and a transport.
131
133
        """
132
134
        # Serve from the current directory
133
 
        process = self.start_bzr_subprocess(['serve', '--inet'])
 
135
        args = ['serve', '--inet']
 
136
        args.extend(extra_options)
 
137
        process = self.start_bzr_subprocess(args)
134
138
 
135
139
        # Connect to the server
136
140
        # We use this url because while this is no valid URL to connect to this
180
184
 
181
185
        process, transport = self.start_server_inet(['--allow-writes'])
182
186
 
183
 
        # We get a working branch
 
187
        # We get a working branch, and can create a directory
184
188
        branch = BzrDir.open_from_transport(transport).open_branch()
185
189
        self.make_read_requests(branch)
 
190
        transport.mkdir('adir')
186
191
        self.assertInetServerShutsdownCleanly(process)
187
192
 
188
193
    def test_bzr_serve_port_readonly(self):
215
220
        self.make_read_requests(branch)
216
221
        self.assertServerFinishesCleanly(process)
217
222
 
 
223
    def test_bzr_serve_dhpss(self):
 
224
        # This is a smoke test that the server doesn't crash when run with
 
225
        # -Dhpss, and does drop some hpss logging to the file.
 
226
        self.make_branch('.')
 
227
        log_fname = os.getcwd() + '/server.log'
 
228
        self._captureVar('BZR_LOG', log_fname)
 
229
        process, transport = self.start_server_inet(['-Dhpss'])
 
230
        branch = BzrDir.open_from_transport(transport).open_branch()
 
231
        self.make_read_requests(branch)
 
232
        self.assertInetServerShutsdownCleanly(process)
 
233
        f = open(log_fname, 'rb')
 
234
        content = f.read()
 
235
        f.close()
 
236
        self.assertContainsRe(content, 'hpss request: \[')
 
237
 
218
238
 
219
239
class TestCmdServeChrooting(TestBzrServeBase):
220
240