Rev 6284: (jelmer) Test the number of HPSS calls for some common opererations. (Jelmer in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/
Patch Queue Manager
pqm at pqm.ubuntu.com
Wed Nov 23 11:48:53 UTC 2011
At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 6284 [merge]
revision-id: pqm at pqm.ubuntu.com-20111123114853-98k118t2i003fdzn
parent: pqm at pqm.ubuntu.com-20111122135259-dfjq13wb2z4ndbh6
parent: jelmer at samba.org-20111123112256-e0k90g9zz3fj0zvg
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2011-11-23 11:48:53 +0000
message:
(jelmer) Test the number of HPSS calls for some common opererations. (Jelmer
Vernooij)
modified:
bzrlib/tests/blackbox/test_annotate.py testannotate.py-20051013044000-457f44801bfa9d39
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_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_lookup_revision.py test_lookup_revision-20100502193624-95yx8byn08gv5rtr-1
bzrlib/tests/blackbox/test_ls.py test_ls.py-20060712232047-0jraqpecwngee12y-1
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_sign_my_commits.py test_sign_my_commits.py-20060215152957-270238a1ffacc841
bzrlib/tests/blackbox/test_tags.py test_tags.py-20070116132048-5h4qak2cm22jlb9e-1
bzrlib/tests/test_log.py testlog.py-20050728115707-1a514809d7d49309
=== modified file 'bzrlib/tests/blackbox/test_annotate.py'
--- a/bzrlib/tests/blackbox/test_annotate.py 2011-06-13 15:18:27 +0000
+++ b/bzrlib/tests/blackbox/test_annotate.py 2011-11-22 23:26:48 +0000
@@ -307,3 +307,22 @@
wt.commit('commit', committer='test at user')
out, err = self.run_bzr(['annotate', '-d', 'a', 'hello.txt'])
self.assertEqualDiff('1 test at us | my helicopter\n', out)
+
+
+class TestSmartServerAnnotate(tests.TestCaseWithTransport):
+
+ def test_simple_annotate(self):
+ self.setup_smart_server_with_call_log()
+ wt = self.make_branch_and_tree('branch')
+ self.build_tree_contents([('branch/hello.txt', 'my helicopter\n')])
+ wt.add(['hello.txt'])
+ wt.commit('commit', committer='test at user')
+ self.reset_smart_call_log()
+ out, err = self.run_bzr(['annotate', "-d", self.get_url('branch'),
+ "hello.txt"])
+ # 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(19, self.hpss_calls)
=== modified file 'bzrlib/tests/blackbox/test_break_lock.py'
--- a/bzrlib/tests/blackbox/test_break_lock.py 2011-03-10 13:29:54 +0000
+++ b/bzrlib/tests/blackbox/test_break_lock.py 2011-11-22 23:15:35 +0000
@@ -124,3 +124,18 @@
stdin="y\n")
self.assertRaises(errors.LockBroken, self.config.unlock)
+
+class TestSmartServerBreakLock(tests.TestCaseWithTransport):
+
+ def test_simple_branch_break_lock(self):
+ self.setup_smart_server_with_call_log()
+ t = self.make_branch_and_tree('branch')
+ t.branch.lock_write()
+ self.reset_smart_call_log()
+ out, err = self.run_bzr(['break-lock', '--force', self.get_url('branch')])
+ # 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(19, self.hpss_calls)
=== modified file 'bzrlib/tests/blackbox/test_cat.py'
--- a/bzrlib/tests/blackbox/test_cat.py 2011-06-30 17:42:04 +0000
+++ b/bzrlib/tests/blackbox/test_cat.py 2011-11-22 23:15:35 +0000
@@ -221,3 +221,21 @@
url = self.get_readonly_url() + '/a'
out, err = self.run_bzr(['cat', '-d', url, 'README'])
self.assertEqual('contents of a/README\n', out)
+
+
+class TestSmartServerCat(tests.TestCaseWithTransport):
+
+ def test_simple_branch_cat(self):
+ self.setup_smart_server_with_call_log()
+ t = self.make_branch_and_tree('branch')
+ self.build_tree_contents([('branch/foo', 'thecontents')])
+ t.add("foo")
+ t.commit("message")
+ self.reset_smart_call_log()
+ out, err = self.run_bzr(['cat', "%s/foo" % self.get_url('branch')])
+ # 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)
=== modified file 'bzrlib/tests/blackbox/test_export.py'
--- a/bzrlib/tests/blackbox/test_export.py 2011-11-14 05:48:28 +0000
+++ b/bzrlib/tests/blackbox/test_export.py 2011-11-22 23:34:54 +0000
@@ -21,7 +21,6 @@
from StringIO import StringIO
import os
import stat
-import sys
import tarfile
import time
import zipfile
@@ -29,8 +28,6 @@
from bzrlib import (
export,
- osutils,
- tests,
)
from bzrlib.tests import (
features,
@@ -416,3 +413,21 @@
zfile = zipfile.ZipFile('test.zip')
info = zfile.getinfo("test/har")
self.assertEquals(time.localtime(timestamp)[:6], info.date_time)
+
+
+class TestSmartServerExport(TestCaseWithTransport):
+
+ def test_simple_export(self):
+ self.setup_smart_server_with_call_log()
+ t = self.make_branch_and_tree('branch')
+ self.build_tree_contents([('branch/foo', 'thecontents')])
+ t.add("foo")
+ t.commit("message")
+ self.reset_smart_call_log()
+ out, err = self.run_bzr(['export', "foo.tar.gz", self.get_url('branch')])
+ # 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)
=== modified file 'bzrlib/tests/blackbox/test_info.py'
--- a/bzrlib/tests/blackbox/test_info.py 2011-11-15 17:27:46 +0000
+++ b/bzrlib/tests/blackbox/test_info.py 2011-11-22 23:17:05 +0000
@@ -1425,3 +1425,36 @@
0 revisions
""", out)
self.assertEqual("", err)
+
+
+class TestSmartServerInfo(tests.TestCaseWithTransport):
+
+ def test_simple_branch_info(self):
+ self.setup_smart_server_with_call_log()
+ t = self.make_branch_and_tree('branch')
+ self.build_tree_contents([('branch/foo', 'thecontents')])
+ t.add("foo")
+ t.commit("message")
+ self.reset_smart_call_log()
+ out, err = self.run_bzr(['info', self.get_url('branch')])
+ # 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(12, self.hpss_calls)
+
+ def test_verbose_branch_info(self):
+ self.setup_smart_server_with_call_log()
+ t = self.make_branch_and_tree('branch')
+ self.build_tree_contents([('branch/foo', 'thecontents')])
+ t.add("foo")
+ t.commit("message")
+ self.reset_smart_call_log()
+ out, err = self.run_bzr(['info', '-v', self.get_url('branch')])
+ # 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(25, self.hpss_calls)
=== modified file 'bzrlib/tests/blackbox/test_log.py'
--- a/bzrlib/tests/blackbox/test_log.py 2011-10-12 16:00:13 +0000
+++ b/bzrlib/tests/blackbox/test_log.py 2011-11-23 11:22:56 +0000
@@ -1052,3 +1052,36 @@
self.assertLogRevnos(["--match-author", "author"], ["2", "1"])
self.assertLogRevnos(["--match-author", "author1",
"--match-author", "author2"], ["2", "1"])
+
+
+class TestSmartServerLog(tests.TestCaseWithTransport):
+
+ def test_standard_log(self):
+ self.setup_smart_server_with_call_log()
+ t = self.make_branch_and_tree('branch')
+ self.build_tree_contents([('branch/foo', 'thecontents')])
+ t.add("foo")
+ t.commit("message")
+ self.reset_smart_call_log()
+ out, err = self.run_bzr(['log', self.get_url('branch')])
+ # 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(15, self.hpss_calls)
+
+ def test_verbose_log(self):
+ self.setup_smart_server_with_call_log()
+ t = self.make_branch_and_tree('branch')
+ self.build_tree_contents([('branch/foo', 'thecontents')])
+ t.add("foo")
+ t.commit("message")
+ self.reset_smart_call_log()
+ out, err = self.run_bzr(['log', '-v', self.get_url('branch')])
+ # 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(20, self.hpss_calls)
=== modified file 'bzrlib/tests/blackbox/test_lookup_revision.py'
--- a/bzrlib/tests/blackbox/test_lookup_revision.py 2010-05-02 20:10:25 +0000
+++ b/bzrlib/tests/blackbox/test_lookup_revision.py 2011-11-22 23:29:09 +0000
@@ -18,8 +18,6 @@
"""Black-box tests for bzr lookup-revision.
"""
-import os
-
from bzrlib import tests
class TestLookupRevision(tests.TestCaseWithTransport):
=== modified file 'bzrlib/tests/blackbox/test_ls.py'
--- a/bzrlib/tests/blackbox/test_ls.py 2010-05-02 20:10:25 +0000
+++ b/bzrlib/tests/blackbox/test_ls.py 2011-11-22 23:20:48 +0000
@@ -18,7 +18,7 @@
import os
-from bzrlib import ignores, osutils
+from bzrlib import ignores
from bzrlib.tests import TestCaseWithTransport
@@ -244,3 +244,21 @@
self.wt.commit('commit')
self.ls_equals('sub/\nsub/file\n', '--directory=dir')
self.ls_equals('sub/file\n', '-d dir sub')
+
+
+class TestSmartServerLs(TestCaseWithTransport):
+
+ def test_simple_ls(self):
+ self.setup_smart_server_with_call_log()
+ t = self.make_branch_and_tree('branch')
+ self.build_tree_contents([('branch/foo', 'thecontents')])
+ t.add("foo")
+ t.commit("message")
+ self.reset_smart_call_log()
+ out, err = self.run_bzr(['ls', self.get_url('branch')])
+ # 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(15, self.hpss_calls)
=== modified file 'bzrlib/tests/blackbox/test_revno.py'
--- a/bzrlib/tests/blackbox/test_revno.py 2011-10-08 11:42:32 +0000
+++ b/bzrlib/tests/blackbox/test_revno.py 2011-11-22 23:40:50 +0000
@@ -136,3 +136,38 @@
self.assertEqual(
'bzr: ERROR: --tree and --revision can not be used together\n',
err)
+
+
+class TestSmartServerRevno(tests.TestCaseWithTransport):
+
+ def test_simple_branch_revno(self):
+ self.setup_smart_server_with_call_log()
+ t = self.make_branch_and_tree('branch')
+ self.build_tree_contents([('branch/foo', 'thecontents')])
+ t.add("foo")
+ revid = t.commit("message")
+ self.reset_smart_call_log()
+ out, err = self.run_bzr(['revno', self.get_url('branch')])
+ # 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(14, self.hpss_calls)
+
+ def test_simple_branch_revno_lookup(self):
+ self.setup_smart_server_with_call_log()
+ t = self.make_branch_and_tree('branch')
+ self.build_tree_contents([('branch/foo', 'thecontents')])
+ t.add("foo")
+ revid1 = t.commit("message")
+ revid2 = t.commit("message")
+ self.reset_smart_call_log()
+ out, err = self.run_bzr(['revno', '-rrevid:' + revid1,
+ self.get_url('branch')])
+ # 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(13, self.hpss_calls)
=== modified file 'bzrlib/tests/blackbox/test_rmbranch.py'
--- a/bzrlib/tests/blackbox/test_rmbranch.py 2011-05-13 12:51:05 +0000
+++ b/bzrlib/tests/blackbox/test_rmbranch.py 2011-11-22 23:22:08 +0000
@@ -57,3 +57,18 @@
self.run_bzr('rmbranch', working_dir='a')
dir = bzrdir.BzrDir.open('a')
self.assertFalse(dir.has_branch())
+
+
+class TestSmartServerRemoveBranch(TestCaseWithTransport):
+
+ def test_simple_remove_branch(self):
+ self.setup_smart_server_with_call_log()
+ self.make_branch('branch')
+ self.reset_smart_call_log()
+ out, err = self.run_bzr(['rmbranch', self.get_url('branch')])
+ # 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(18, self.hpss_calls)
=== modified file 'bzrlib/tests/blackbox/test_sign_my_commits.py'
--- a/bzrlib/tests/blackbox/test_sign_my_commits.py 2011-08-16 11:05:38 +0000
+++ b/bzrlib/tests/blackbox/test_sign_my_commits.py 2011-11-22 23:31:21 +0000
@@ -137,3 +137,44 @@
'0 commits with unknown keys\n'
'0 commits not valid\n'
'1 commit not signed\n', ''), out)
+
+
+class TestSmartServerSignMyCommits(tests.TestCaseWithTransport):
+
+ def monkey_patch_gpg(self):
+ """Monkey patch the gpg signing strategy to be a loopback.
+
+ This also registers the cleanup, so that we will revert to
+ the original gpg strategy when done.
+ """
+ # monkey patch gpg signing mechanism
+ self.overrideAttr(gpg, 'GPGStrategy', gpg.LoopbackGPGStrategy)
+
+ def test_sign_single_commit(self):
+ self.setup_smart_server_with_call_log()
+ t = self.make_branch_and_tree('branch')
+ self.build_tree_contents([('branch/foo', 'thecontents')])
+ t.add("foo")
+ t.commit("message")
+ self.reset_smart_call_log()
+ self.monkey_patch_gpg()
+ out, err = self.run_bzr(['sign-my-commits', self.get_url('branch')])
+ # 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(53, self.hpss_calls)
+
+ def test_verify_commits(self):
+ self.setup_smart_server_with_call_log()
+ t = self.make_branch_and_tree('branch')
+ self.build_tree_contents([('branch/foo', 'thecontents')])
+ t.add("foo")
+ t.commit("message")
+ self.monkey_patch_gpg()
+ out, err = self.run_bzr(['sign-my-commits', self.get_url('branch')])
+ self.reset_smart_call_log()
+ self.run_bzr('sign-my-commits')
+ out = self.run_bzr(['verify-signatures', self.get_url('branch')])
+ self.assertLength(21, self.hpss_calls)
=== modified file 'bzrlib/tests/blackbox/test_tags.py'
--- a/bzrlib/tests/blackbox/test_tags.py 2011-09-25 14:36:30 +0000
+++ b/bzrlib/tests/blackbox/test_tags.py 2011-11-22 23:33:35 +0000
@@ -406,3 +406,38 @@
'tag2 2\n'
'unknown ?\n')
self.assertEqual('', err)
+
+
+class TestSmartServerCat(TestCaseWithTransport):
+
+ def test_set_tag(self):
+ self.setup_smart_server_with_call_log()
+ t = self.make_branch_and_tree('branch')
+ self.build_tree_contents([('branch/foo', 'thecontents')])
+ t.add("foo")
+ t.commit("message")
+ self.reset_smart_call_log()
+ out, err = self.run_bzr(['tag', "-d", self.get_url('branch'), "tagname"])
+ # 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(9, self.hpss_calls)
+
+ def test_show_tags(self):
+ self.setup_smart_server_with_call_log()
+ t = self.make_branch_and_tree('branch')
+ self.build_tree_contents([('branch/foo', 'thecontents')])
+ t.add("foo")
+ t.commit("message")
+ t.branch.tags.set_tag("sometag", "rev1")
+ t.branch.tags.set_tag("sometag", "rev2")
+ self.reset_smart_call_log()
+ out, err = self.run_bzr(['tags', "-d", self.get_url('branch')])
+ # 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(16, self.hpss_calls)
=== modified file 'bzrlib/tests/test_log.py'
--- a/bzrlib/tests/test_log.py 2011-09-19 15:22:23 +0000
+++ b/bzrlib/tests/test_log.py 2011-11-23 11:22:56 +0000
@@ -24,7 +24,6 @@
registry,
revision,
revisionspec,
- symbol_versioning,
tests,
)
@@ -1636,3 +1635,4 @@
log.Logger(b, request).show(log_formatter)
# should now only have 2 revisions:
self.assertEquals(len(log_formatter.revisions), 2)
+
More information about the bazaar-commits
mailing list