~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

(jelmer) Check number of connections opened during various blackbox tests.
 (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
from bzrlib.tests.features import UnicodeFilenameFeature
35
35
from bzrlib.directory_service import directories
36
36
 
 
37
from bzrlib.tests.matchers import ContainsNoVfsCalls
 
38
 
37
39
 
38
40
class TestSwitch(TestCaseWithTransport):
39
41
 
428
430
        # This test should be cleaner to write, but see bug:
429
431
        #  https://bugs.launchpad.net/bzr/+bug/812295
430
432
        self.assertEqual(1, opened.count('master'))
 
433
 
 
434
 
 
435
class TestSmartServerSwitch(TestCaseWithTransport):
 
436
 
 
437
    def test_switch_lightweight(self):
 
438
        self.setup_smart_server_with_call_log()
 
439
        t = self.make_branch_and_tree('from')
 
440
        for count in range(9):
 
441
            t.commit(message='commit %d' % count)
 
442
        out, err = self.run_bzr(['checkout', '--lightweight', self.get_url('from'),
 
443
            'target'])
 
444
        self.reset_smart_call_log()
 
445
        self.run_bzr(['switch', self.get_url('from')], working_dir='target')
 
446
        # This figure represent the amount of work to perform this use case. It
 
447
        # is entirely ok to reduce this number if a test fails due to rpc_count
 
448
        # being too low. If rpc_count increases, more network roundtrips have
 
449
        # become necessary for this use case. Please do not adjust this number
 
450
        # upwards without agreement from bzr's network support maintainers.
 
451
        self.assertLength(24, self.hpss_calls)
 
452
        self.assertLength(5, self.hpss_connections)
 
453
        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)