Rev 6407: (jelmer) Check number of connections opened during various blackbox tests. in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

Patch Queue Manager pqm at pqm.ubuntu.com
Fri Dec 30 15:23:52 UTC 2011


At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 6407 [merge]
revision-id: pqm at pqm.ubuntu.com-20111230152351-mgfr73vrn8jrqh53
parent: pqm at pqm.ubuntu.com-20111229231547-vupamntx69hwp8dl
parent: jelmer at samba.org-20111230143646-5zxyaa7g26zoidlh
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2011-12-30 15:23:51 +0000
message:
  (jelmer) Check number of connections opened during various blackbox tests.
   (Jelmer Vernooij)
modified:
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
  bzrlib/tests/blackbox/test_annotate.py testannotate.py-20051013044000-457f44801bfa9d39
  bzrlib/tests/blackbox/test_branch.py test_branch.py-20060524161337-noms9gmcwqqrfi8y-1
  bzrlib/tests/blackbox/test_break_lock.py test_break_lock.py-20060303014503-a90e07d38d042d1d
  bzrlib/tests/blackbox/test_cat.py test_cat.py-20051201162916-f0937e4e19ea24b3
  bzrlib/tests/blackbox/test_checkout.py test_checkout.py-20060211231752-a5cde67cf70af854
  bzrlib/tests/blackbox/test_commit.py test_commit.py-20060212094538-ae88fc861d969db0
  bzrlib/tests/blackbox/test_config.py test_config.py-20100927150753-x6rf54uibd08r636-1
  bzrlib/tests/blackbox/test_export.py test_export.py-20051229024010-e6c26658e460fb1c
  bzrlib/tests/blackbox/test_info.py test_info.py-20060215045507-bbdd2d34efab9e0a
  bzrlib/tests/blackbox/test_log.py test_log.py-20060112090212-78f6ea560c868e24
  bzrlib/tests/blackbox/test_ls.py test_ls.py-20060712232047-0jraqpecwngee12y-1
  bzrlib/tests/blackbox/test_pack.py test_pack.py-20070712120702-0c7585lh56p894mo-1
  bzrlib/tests/blackbox/test_pull.py test_pull.py-20051201144907-64959364f629947f
  bzrlib/tests/blackbox/test_push.py test_push.py-20060329002750-929af230d5d22663
  bzrlib/tests/blackbox/test_reconcile.py test_fix.py-20060223013051-9a188e15a5ee9451
  bzrlib/tests/blackbox/test_revno.py test_revno.py-20051204214528-2f0bf83a71b7656a
  bzrlib/tests/blackbox/test_rmbranch.py test_rmbranch.py-20100131150653-auenl06hu4y2d9tr-1
  bzrlib/tests/blackbox/test_send.py test_bundle.py-20060616222707-c21c8b7ea5ef57b1
  bzrlib/tests/blackbox/test_shared_repository.py test_shared_repository.py-20060317053531-ed30c0d79325e483
  bzrlib/tests/blackbox/test_sign_my_commits.py test_sign_my_commits.py-20060215152957-270238a1ffacc841
  bzrlib/tests/blackbox/test_switch.py test_switch.py-20071122111948-0c5en6uz92bwl76h-1
  bzrlib/tests/blackbox/test_tags.py test_tags.py-20070116132048-5h4qak2cm22jlb9e-1
  bzrlib/tests/blackbox/test_uncommit.py test_uncommit.py-20051027212835-84944b63adae51be
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2011-12-29 21:05:11 +0000
+++ b/bzrlib/builtins.py	2011-12-30 14:36:46 +0000
@@ -2086,14 +2086,16 @@
             location = '.'
 
         to_transport = transport.get_transport(location)
-        to_transport.ensure_base()
 
-        newdir = format.initialize_on_transport(to_transport)
-        repo = newdir.create_repository(shared=True)
-        repo.set_make_working_trees(not no_trees)
+        (repo, newdir, require_stacking, repository_policy) = (
+            format.initialize_on_transport_ex(to_transport,
+            create_prefix=True, make_working_trees=not no_trees,
+            shared_repo=True, force_new_repo=True,
+            use_existing_dir=True,
+            repo_format_name=format.repository_format.get_format_string()))
         if not is_quiet():
             from bzrlib.info import show_bzrdir_info
-            show_bzrdir_info(repo.bzrdir, verbose=0, outfile=self.outf)
+            show_bzrdir_info(newdir, verbose=0, outfile=self.outf)
 
 
 class cmd_diff(Command):

=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2011-12-24 09:59:02 +0000
+++ b/bzrlib/tests/__init__.py	2011-12-24 10:10:59 +0000
@@ -2759,6 +2759,7 @@
     def setup_smart_server_with_call_log(self):
         """Sets up a smart server as the transport server with a call log."""
         self.transport_server = test_server.SmartTCPServer_for_testing
+        self.hpss_connections = []
         self.hpss_calls = []
         import traceback
         # Skip the current stack down to the caller of
@@ -2767,11 +2768,16 @@
         def capture_hpss_call(params):
             self.hpss_calls.append(
                 CapturedCall(params, prefix_length))
+        def capture_connect(transport):
+            self.hpss_connections.append(transport)
         client._SmartClient.hooks.install_named_hook(
             'call', capture_hpss_call, None)
+        _mod_transport.Transport.hooks.install_named_hook(
+            'post_connect', capture_connect, None)
 
     def reset_smart_call_log(self):
         self.hpss_calls = []
+        self.hpss_connections = []
 
 
 class TestCaseInTempDir(TestCaseWithMemoryTransport):

=== modified file 'bzrlib/tests/blackbox/test_annotate.py'
--- a/bzrlib/tests/blackbox/test_annotate.py	2011-12-14 20:08:26 +0000
+++ b/bzrlib/tests/blackbox/test_annotate.py	2011-12-14 21:57:37 +0000
@@ -327,5 +327,6 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(15, self.hpss_calls)
+        self.assertLength(1, self.hpss_connections)
         self.expectFailure("annotate accesses inventories, which require VFS access",
             self.assertThat, self.hpss_calls, ContainsNoVfsCalls)

=== modified file 'bzrlib/tests/blackbox/test_branch.py'
--- a/bzrlib/tests/blackbox/test_branch.py	2011-12-21 14:28:03 +0000
+++ b/bzrlib/tests/blackbox/test_branch.py	2011-12-24 10:10:59 +0000
@@ -483,6 +483,7 @@
         # being too low. If rpc_count increases, more network roundtrips have
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
+        self.assertLength(2, self.hpss_connections)
         self.assertLength(33, self.hpss_calls)
         self.expectFailure("branching to the same branch requires VFS access",
             self.assertThat, self.hpss_calls, ContainsNoVfsCalls)
@@ -502,6 +503,7 @@
         # upwards without agreement from bzr's network support maintainers.
         self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
         self.assertLength(10, self.hpss_calls)
+        self.assertLength(1, self.hpss_connections)
 
     def test_branch_from_trivial_stacked_branch_streaming_acceptance(self):
         self.setup_smart_server_with_call_log()
@@ -522,6 +524,7 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(15, self.hpss_calls)
+        self.assertLength(1, self.hpss_connections)
         self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
 
     def test_branch_from_branch_with_tags(self):
@@ -541,6 +544,7 @@
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(10, self.hpss_calls)
         self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
+        self.assertLength(1, self.hpss_connections)
 
     def test_branch_to_stacked_from_trivial_branch_streaming_acceptance(self):
         self.setup_smart_server_with_call_log()
@@ -559,6 +563,7 @@
         readvs_of_rix_files = [
             c for c in self.hpss_calls
             if c.call.method == 'readv' and c.call.args[-1].endswith('.rix')]
+        self.assertLength(1, self.hpss_connections)
         self.assertLength(0, readvs_of_rix_files)
         self.expectFailure("branching to stacked requires VFS access",
             self.assertThat, self.hpss_calls, ContainsNoVfsCalls)

=== modified file 'bzrlib/tests/blackbox/test_break_lock.py'
--- a/bzrlib/tests/blackbox/test_break_lock.py	2011-12-14 12:15:44 +0000
+++ b/bzrlib/tests/blackbox/test_break_lock.py	2011-12-14 20:21:52 +0000
@@ -140,4 +140,5 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
+        self.assertLength(1, self.hpss_connections)
         self.assertLength(5, self.hpss_calls)

=== modified file 'bzrlib/tests/blackbox/test_cat.py'
--- a/bzrlib/tests/blackbox/test_cat.py	2011-12-14 20:08:26 +0000
+++ b/bzrlib/tests/blackbox/test_cat.py	2011-12-14 21:57:37 +0000
@@ -240,4 +240,5 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(9, self.hpss_calls)
+        self.assertLength(1, self.hpss_connections)
         self.assertThat(self.hpss_calls, ContainsNoVfsCalls)

=== modified file 'bzrlib/tests/blackbox/test_checkout.py'
--- a/bzrlib/tests/blackbox/test_checkout.py	2011-12-14 20:08:26 +0000
+++ b/bzrlib/tests/blackbox/test_checkout.py	2011-12-14 21:57:37 +0000
@@ -186,6 +186,7 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(10, self.hpss_calls)
+        self.assertLength(1, self.hpss_connections)
         self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
 
     def test_lightweight_checkout(self):

=== modified file 'bzrlib/tests/blackbox/test_commit.py'
--- a/bzrlib/tests/blackbox/test_commit.py	2011-12-22 16:18:31 +0000
+++ b/bzrlib/tests/blackbox/test_commit.py	2011-12-30 14:19:53 +0000
@@ -890,5 +890,6 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(213, self.hpss_calls)
+        self.assertLength(2, self.hpss_connections)
         self.expectFailure("commit still uses VFS calls",
             self.assertThat, self.hpss_calls, ContainsNoVfsCalls)

=== modified file 'bzrlib/tests/blackbox/test_config.py'
--- a/bzrlib/tests/blackbox/test_config.py	2011-12-21 10:55:43 +0000
+++ b/bzrlib/tests/blackbox/test_config.py	2011-12-24 10:10:59 +0000
@@ -351,4 +351,5 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(5, self.hpss_calls)
+        self.assertLength(1, self.hpss_connections)
         self.assertThat(self.hpss_calls, ContainsNoVfsCalls)

=== modified file 'bzrlib/tests/blackbox/test_export.py'
--- a/bzrlib/tests/blackbox/test_export.py	2011-12-14 20:08:26 +0000
+++ b/bzrlib/tests/blackbox/test_export.py	2011-12-14 21:57:37 +0000
@@ -449,4 +449,5 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(7, self.hpss_calls)
+        self.assertLength(1, self.hpss_connections)
         self.assertThat(self.hpss_calls, ContainsNoVfsCalls)

=== modified file 'bzrlib/tests/blackbox/test_info.py'
--- a/bzrlib/tests/blackbox/test_info.py	2011-12-14 12:15:44 +0000
+++ b/bzrlib/tests/blackbox/test_info.py	2011-12-14 20:21:52 +0000
@@ -1444,6 +1444,7 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(12, self.hpss_calls)
+        self.assertLength(1, self.hpss_connections)
         self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
 
     def test_verbose_branch_info(self):
@@ -1460,4 +1461,5 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(16, self.hpss_calls)
+        self.assertLength(1, self.hpss_connections)
         self.assertThat(self.hpss_calls, ContainsNoVfsCalls)

=== modified file 'bzrlib/tests/blackbox/test_log.py'
--- a/bzrlib/tests/blackbox/test_log.py	2011-12-15 14:47:22 +0000
+++ b/bzrlib/tests/blackbox/test_log.py	2011-12-21 14:50:43 +0000
@@ -1095,6 +1095,7 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
+        self.assertLength(1, self.hpss_connections)
         self.assertLength(10, self.hpss_calls)
 
     def test_verbose_log(self):
@@ -1111,6 +1112,7 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(11, self.hpss_calls)
+        self.assertLength(1, self.hpss_connections)
         self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
 
     def test_per_file(self):
@@ -1127,4 +1129,5 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(15, self.hpss_calls)
+        self.assertLength(1, self.hpss_connections)
         self.assertThat(self.hpss_calls, ContainsNoVfsCalls)

=== modified file 'bzrlib/tests/blackbox/test_ls.py'
--- a/bzrlib/tests/blackbox/test_ls.py	2011-12-14 20:08:26 +0000
+++ b/bzrlib/tests/blackbox/test_ls.py	2011-12-14 21:57:37 +0000
@@ -263,4 +263,5 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(6, self.hpss_calls)
+        self.assertLength(1, self.hpss_connections)
         self.assertThat(self.hpss_calls, ContainsNoVfsCalls)

=== modified file 'bzrlib/tests/blackbox/test_pack.py'
--- a/bzrlib/tests/blackbox/test_pack.py	2011-12-14 20:08:26 +0000
+++ b/bzrlib/tests/blackbox/test_pack.py	2011-12-14 21:57:37 +0000
@@ -103,4 +103,5 @@
         # adjust this number upwards without agreement from bzr's network
         # support maintainers.
         self.assertLength(6, self.hpss_calls)
+        self.assertLength(1, self.hpss_connections)
         self.assertThat(self.hpss_calls, ContainsNoVfsCalls)

=== modified file 'bzrlib/tests/blackbox/test_pull.py'
--- a/bzrlib/tests/blackbox/test_pull.py	2011-10-14 13:56:45 +0000
+++ b/bzrlib/tests/blackbox/test_pull.py	2011-12-14 20:21:52 +0000
@@ -421,6 +421,7 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(19, self.hpss_calls)
+        self.assertLength(1, self.hpss_connections)
         remote = Branch.open('stacked')
         self.assertEndsWith(remote.get_stacked_on_url(), '/parent')
 

=== modified file 'bzrlib/tests/blackbox/test_push.py'
--- a/bzrlib/tests/blackbox/test_push.py	2011-12-21 19:10:39 +0000
+++ b/bzrlib/tests/blackbox/test_push.py	2011-12-24 10:10:59 +0000
@@ -38,6 +38,7 @@
     script,
     test_foreign,
     )
+from bzrlib.tests.matchers import ContainsNoVfsCalls
 from bzrlib.transport import memory
 
 
@@ -267,6 +268,8 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(9, self.hpss_calls)
+        self.assertLength(1, self.hpss_connections)
+        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
 
     def test_push_smart_stacked_streaming_acceptance(self):
         self.setup_smart_server_with_call_log()
@@ -283,6 +286,8 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(14, self.hpss_calls)
+        self.assertLength(1, self.hpss_connections)
+        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
         remote = branch.Branch.open('public')
         self.assertEndsWith(remote.get_stacked_on_url(), '/parent')
 
@@ -299,6 +304,8 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(11, self.hpss_calls)
+        self.assertLength(1, self.hpss_connections)
+        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
 
     def test_push_smart_incremental_acceptance(self):
         self.setup_smart_server_with_call_log()
@@ -315,6 +322,8 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(11, self.hpss_calls)
+        self.assertLength(1, self.hpss_connections)
+        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
 
     def test_push_smart_with_default_stacking_url_path_segment(self):
         # If the default stacked-on location is a path element then branches

=== modified file 'bzrlib/tests/blackbox/test_reconcile.py'
--- a/bzrlib/tests/blackbox/test_reconcile.py	2011-12-11 16:03:42 +0000
+++ b/bzrlib/tests/blackbox/test_reconcile.py	2011-12-14 20:21:52 +0000
@@ -22,6 +22,7 @@
     inventory,
     tests,
     )
+from bzrlib.tests.matchers import ContainsNoVfsCalls
 
 
 class TrivialTest(tests.TestCaseWithTransport):
@@ -86,3 +87,5 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(10, self.hpss_calls)
+        self.assertLength(1, self.hpss_connections)
+        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)

=== modified file 'bzrlib/tests/blackbox/test_revno.py'
--- a/bzrlib/tests/blackbox/test_revno.py	2011-12-14 12:15:44 +0000
+++ b/bzrlib/tests/blackbox/test_revno.py	2011-12-14 20:21:52 +0000
@@ -156,6 +156,7 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
+        self.assertLength(1, self.hpss_connections)
         self.assertLength(6, self.hpss_calls)
 
     def test_simple_branch_revno_lookup(self):
@@ -174,4 +175,5 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(5, self.hpss_calls)
+        self.assertLength(1, self.hpss_connections)
         self.assertThat(self.hpss_calls, ContainsNoVfsCalls)

=== modified file 'bzrlib/tests/blackbox/test_rmbranch.py'
--- a/bzrlib/tests/blackbox/test_rmbranch.py	2011-12-14 12:15:44 +0000
+++ b/bzrlib/tests/blackbox/test_rmbranch.py	2011-12-14 20:21:52 +0000
@@ -84,4 +84,5 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(5, self.hpss_calls)
+        self.assertLength(1, self.hpss_connections)
         self.assertThat(self.hpss_calls, ContainsNoVfsCalls)

=== modified file 'bzrlib/tests/blackbox/test_send.py'
--- a/bzrlib/tests/blackbox/test_send.py	2011-12-14 15:47:45 +0000
+++ b/bzrlib/tests/blackbox/test_send.py	2011-12-14 20:21:52 +0000
@@ -460,4 +460,5 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(9, self.hpss_calls)
+        self.assertLength(1, self.hpss_connections)
         self.assertThat(self.hpss_calls, ContainsNoVfsCalls)

=== modified file 'bzrlib/tests/blackbox/test_shared_repository.py'
--- a/bzrlib/tests/blackbox/test_shared_repository.py	2011-11-17 11:50:19 +0000
+++ b/bzrlib/tests/blackbox/test_shared_repository.py	2011-12-30 14:36:46 +0000
@@ -21,6 +21,8 @@
 from bzrlib.bzrdir import BzrDir, BzrDirMetaFormat1
 import bzrlib.errors as errors
 from bzrlib.tests import TestCaseInTempDir
+from bzrlib.tests.matchers import ContainsNoVfsCalls
+
 
 class TestSharedRepo(TestCaseInTempDir):
 
@@ -119,7 +121,9 @@
         # being too low. If rpc_count increases, more network roundtrips have
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
-        self.assertLength(13, self.hpss_calls)
+        self.assertLength(10, self.hpss_calls)
+        self.assertLength(1, self.hpss_connections)
+        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
 
     def test_notification_on_branch_from_repository(self):
         out, err = self.run_bzr("init-repository -q a")

=== modified file 'bzrlib/tests/blackbox/test_sign_my_commits.py'
--- a/bzrlib/tests/blackbox/test_sign_my_commits.py	2011-12-14 20:08:26 +0000
+++ b/bzrlib/tests/blackbox/test_sign_my_commits.py	2011-12-14 21:57:37 +0000
@@ -166,6 +166,7 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(15, self.hpss_calls)
+        self.assertLength(1, self.hpss_connections)
         self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
 
     def test_verify_commits(self):
@@ -185,4 +186,5 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(10, self.hpss_calls)
+        self.assertLength(1, self.hpss_connections)
         self.assertThat(self.hpss_calls, ContainsNoVfsCalls)

=== modified file 'bzrlib/tests/blackbox/test_switch.py'
--- a/bzrlib/tests/blackbox/test_switch.py	2011-12-09 04:24:45 +0000
+++ b/bzrlib/tests/blackbox/test_switch.py	2011-12-14 21:57:37 +0000
@@ -34,6 +34,8 @@
 from bzrlib.tests.features import UnicodeFilenameFeature
 from bzrlib.directory_service import directories
 
+from bzrlib.tests.matchers import ContainsNoVfsCalls
+
 
 class TestSwitch(TestCaseWithTransport):
 
@@ -428,3 +430,24 @@
         # This test should be cleaner to write, but see bug:
         #  https://bugs.launchpad.net/bzr/+bug/812295
         self.assertEqual(1, opened.count('master'))
+
+
+class TestSmartServerSwitch(TestCaseWithTransport):
+
+    def test_switch_lightweight(self):
+        self.setup_smart_server_with_call_log()
+        t = self.make_branch_and_tree('from')
+        for count in range(9):
+            t.commit(message='commit %d' % count)
+        out, err = self.run_bzr(['checkout', '--lightweight', self.get_url('from'),
+            'target'])
+        self.reset_smart_call_log()
+        self.run_bzr(['switch', self.get_url('from')], working_dir='target')
+        # This figure represent the amount of work to perform this use case. It
+        # is entirely ok to reduce this number if a test fails due to rpc_count
+        # being too low. If rpc_count increases, more network roundtrips have
+        # become necessary for this use case. Please do not adjust this number
+        # upwards without agreement from bzr's network support maintainers.
+        self.assertLength(24, self.hpss_calls)
+        self.assertLength(5, self.hpss_connections)
+        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)

=== modified file 'bzrlib/tests/blackbox/test_tags.py'
--- a/bzrlib/tests/blackbox/test_tags.py	2011-12-14 12:15:44 +0000
+++ b/bzrlib/tests/blackbox/test_tags.py	2011-12-14 20:21:52 +0000
@@ -425,6 +425,7 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(9, self.hpss_calls)
+        self.assertLength(1, self.hpss_connections)
         self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
 
     def test_show_tags(self):
@@ -443,4 +444,5 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(6, self.hpss_calls)
+        self.assertLength(1, self.hpss_connections)
         self.assertThat(self.hpss_calls, ContainsNoVfsCalls)

=== modified file 'bzrlib/tests/blackbox/test_uncommit.py'
--- a/bzrlib/tests/blackbox/test_uncommit.py	2011-12-14 12:15:44 +0000
+++ b/bzrlib/tests/blackbox/test_uncommit.py	2011-12-14 20:21:52 +0000
@@ -312,4 +312,5 @@
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
         self.assertLength(14, self.hpss_calls)
+        self.assertLength(1, self.hpss_connections)
         self.assertThat(self.hpss_calls, ContainsNoVfsCalls)




More information about the bazaar-commits mailing list