~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bzrdir.py

  • Committer: Robert Collins
  • Date: 2009-02-19 01:41:43 UTC
  • mto: This revision was merged to the branch mainline in revision 4020.
  • Revision ID: robertc@robertcollins.net-20090219014143-wv42sc7z71wbhht0
Add BzrDirFormatMeta1 test for the amount of rpc calls made initializing over the network.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
    repository,
33
33
    osutils,
34
34
    symbol_versioning,
 
35
    remote,
35
36
    urlutils,
36
37
    win32utils,
37
38
    workingtree,
885
886
        self.assertTrue(tree.bzrdir.needs_format_conversion(
886
887
            new_format))
887
888
 
 
889
    def test_initialize_on_format_uses_smart_transport(self):
 
890
        self.setup_smart_server_with_call_log()
 
891
        new_format = bzrdir.format_registry.make_bzrdir('dirstate')
 
892
        transport = self.get_transport('target')
 
893
        transport.ensure_base()
 
894
        self.reset_smart_call_log()
 
895
        instance = new_format.initialize_on_transport(transport)
 
896
        self.assertIsInstance(instance, remote.RemoteBzrDir)
 
897
        rpc_count = len(self.hpss_calls)
 
898
        # This figure represent the amount of work to perform this use case. It
 
899
        # is entirely ok to reduce this number if a test fails due to rpc_count
 
900
        # being too low. If rpc_count increases, more network roundtrips have
 
901
        # become necessary for this use case. Please do not adjust this number
 
902
        # upwards without agreement from bzr's network support maintainers.
 
903
        self.assertEqual(15, rpc_count)
 
904
 
888
905
 
889
906
class TestFormat5(TestCaseWithTransport):
890
907
    """Tests specific to the version 5 bzrdir format."""