~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-11-27 23:21:36 UTC
  • mfrom: (4585.1.19 foreign-tests-4)
  • Revision ID: pqm@pqm.ubuntu.com-20091127232136-bkm3vrye2wt4odbw
(Jelmer) Add basic tests for foreign repositories.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
from bzrlib import (
29
29
    builtins,
30
 
    debug,
31
30
    errors,
32
31
    osutils,
33
32
    revision as _mod_revision,
38
37
from bzrlib.smart import client, medium
39
38
from bzrlib.smart.server import BzrServerFactory, SmartTCPServer
40
39
from bzrlib.tests import (
 
40
    ParamikoFeature,
41
41
    TestCaseWithMemoryTransport,
42
42
    TestCaseWithTransport,
43
43
    TestSkipped,
45
45
from bzrlib.trace import mutter
46
46
from bzrlib.transport import get_transport, remote
47
47
 
48
 
 
49
48
class TestBzrServeBase(TestCaseWithTransport):
50
49
 
51
50
    def run_bzr_serve_then_func(self, serve_args, retcode=0, func=None,
131
130
            finish_bzr_subprocess, a client for the server, and a transport.
132
131
        """
133
132
        # Serve from the current directory
134
 
        args = ['serve', '--inet']
135
 
        args.extend(extra_options)
136
 
        process = self.start_bzr_subprocess(args)
 
133
        process = self.start_bzr_subprocess(['serve', '--inet'])
137
134
 
138
135
        # Connect to the server
139
136
        # We use this url because while this is no valid URL to connect to this
183
180
 
184
181
        process, transport = self.start_server_inet(['--allow-writes'])
185
182
 
186
 
        # We get a working branch, and can create a directory
 
183
        # We get a working branch
187
184
        branch = BzrDir.open_from_transport(transport).open_branch()
188
185
        self.make_read_requests(branch)
189
 
        transport.mkdir('adir')
190
186
        self.assertInetServerShutsdownCleanly(process)
191
187
 
192
188
    def test_bzr_serve_port_readonly(self):
219
215
        self.make_read_requests(branch)
220
216
        self.assertServerFinishesCleanly(process)
221
217
 
222
 
    def test_bzr_serve_dhpss(self):
223
 
        # This is a smoke test that the server doesn't crash when run with
224
 
        # -Dhpss, and does drop some hpss logging to the file.
225
 
        self.make_branch('.')
226
 
        log_fname = os.getcwd() + '/server.log'
227
 
        self._captureVar('BZR_LOG', log_fname)
228
 
        process, transport = self.start_server_inet(['-Dhpss'])
229
 
        branch = BzrDir.open_from_transport(transport).open_branch()
230
 
        self.make_read_requests(branch)
231
 
        self.assertInetServerShutsdownCleanly(process)
232
 
        f = open(log_fname, 'rb')
233
 
        content = f.read()
234
 
        f.close()
235
 
        self.assertContainsRe(content, r'hpss request: \[[0-9-]+\]')
236
 
 
237
218
 
238
219
class TestCmdServeChrooting(TestBzrServeBase):
239
220
 
287
268
        return path
288
269
 
289
270
    def make_test_server(self, base_path='/'):
290
 
        """Make and start a BzrServerFactory, backed by a memory transport, and
 
271
        """Make and setUp a BzrServerFactory, backed by a memory transport, and
291
272
        creat '/home/user' in that transport.
292
273
        """
293
274
        bzr_server = BzrServerFactory(