Rev 6334: (jelmer) Add HPSS call count tests for 'bzr co', in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

Patch Queue Manager pqm at pqm.ubuntu.com
Thu Dec 1 11:53:02 UTC 2011


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

------------------------------------------------------------
revno: 6334 [merge]
revision-id: pqm at pqm.ubuntu.com-20111201115302-ca9t4zzn13swv0p1
parent: pqm at pqm.ubuntu.com-20111201112749-5b4e6ae2utuclht2
parent: jelmer at samba.org-20111201111341-x88w4p085ql5b7rq
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2011-12-01 11:53:02 +0000
message:
  (jelmer) Add HPSS call count tests for 'bzr co',
   'bzr co --lightweight' and 'bzr commit' in a lightweight checkout. (Jelmer
   Vernooij)
modified:
  bzrlib/tests/blackbox/test_checkout.py test_checkout.py-20060211231752-a5cde67cf70af854
  bzrlib/tests/blackbox/test_commit.py test_commit.py-20060212094538-ae88fc861d969db0
=== modified file 'bzrlib/tests/blackbox/test_checkout.py'
--- a/bzrlib/tests/blackbox/test_checkout.py	2011-06-14 01:26:41 +0000
+++ b/bzrlib/tests/blackbox/test_checkout.py	2011-12-01 11:13:41 +0000
@@ -16,11 +16,7 @@
 
 """Tests for the 'checkout' CLI command."""
 
-from cStringIO import StringIO
 import os
-import re
-import shutil
-import sys
 
 from bzrlib import (
     branch as _mod_branch,
@@ -31,9 +27,6 @@
 from bzrlib.tests import (
     TestCaseWithTransport,
     )
-from bzrlib.tests import (
-    KnownFailure,
-    )
 from bzrlib.tests.features import (
     HardlinkFeature,
     )
@@ -175,3 +168,39 @@
         second_stat = os.stat('second/file1')
         target_stat = os.stat('target/file1')
         self.assertEqual(second_stat, target_stat)
+
+
+class TestSmartServerCheckout(TestCaseWithTransport):
+
+    def test_heavyweight_checkout(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)
+        self.reset_smart_call_log()
+        out, err = self.run_bzr(['checkout', self.get_url('from'),
+            '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(17, self.hpss_calls)
+
+    def test_lightweight_checkout(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)
+        self.reset_smart_call_log()
+        out, err = self.run_bzr(['checkout', '--lightweight', self.get_url('from'),
+            '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.
+        if len(self.hpss_calls) < 35 or len(self.hpss_calls) > 48:
+            self.fail(
+                "Incorrect length: wanted between 35 and 48, got %d for %r" % (
+                    len(self.hpss_calls), self.hpss_calls))

=== modified file 'bzrlib/tests/blackbox/test_commit.py'
--- a/bzrlib/tests/blackbox/test_commit.py	2011-11-20 01:50:38 +0000
+++ b/bzrlib/tests/blackbox/test_commit.py	2011-11-29 17:23:13 +0000
@@ -833,3 +833,24 @@
         self.assertEqual(out, '')
         self.assertContainsRe(err,
             'Branch.*test_checkout.*appears to be bound to itself')
+
+
+class TestSmartServerCommit(TestCaseWithTransport):
+
+    def test_commit_to_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.build_tree(['target/afile'])
+        self.run_bzr(['add', 'target/afile'])
+        out, err = self.run_bzr(['commit', '-m', 'do something', '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(220, self.hpss_calls)




More information about the bazaar-commits mailing list