[Buildbot-commits] buildbot/buildbot/test test_p4poller.py, 1.4, 1.5

Brian Warner warner at users.sourceforge.net
Wed Feb 28 06:27:52 UTC 2007


Update of /cvsroot/buildbot/buildbot/buildbot/test
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18011/buildbot/test

Modified Files:
	test_p4poller.py 
Log Message:
[project @ p4changes]
Use a more optimal form of "p4 changes", as suggested by Stewart Lord of
Perforce technical support. From the p4d release notes:

  Special handling for @changelist - #85130 **

    The syntax '//path/file at change1, at somethingelse' now performs
    better in many common cases.  Previously, the server would
    search based on changelist number or file path according to
    hard-coded rules.  This worked poorly in a few common cases:
    both '//singlefile at 1, at date' and '//... at 5000,5001' started
    with the wrong search.  This left users trying odd syntax
    to second guess the server.  Now the server adaptively tries
    searching by change number, but if that appears to be too
    inefficient (more than 80% of the revisions not matching the
    path), it switches to searching by path.  (Bug #18689).

In 2wire's case, this was the top source of server load, scanning
~2,200,000 rows for one project and ~2,700,000 rows for another every
10 minutes. Now each scans 10-20 rows on average.
(Figures gathered with -Ztrack=1.)

Original author: Scott Lamb <slamb at slamb.org>
Date: 2007-02-24 02:19:46

Index: test_p4poller.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_p4poller.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- test_p4poller.py	11 Dec 2006 08:23:29 -0000	1.4
+++ test_p4poller.py	28 Feb 2007 06:27:50 -0000	1.5
@@ -38,20 +38,20 @@
 """
 
 p4change = {
-    '3': change_3_log +
+    3: change_3_log +
 """Affected files ...
 
 ... //depot/myproject/branch_b/branch_b_file#1 add
 ... //depot/myproject/branch_b/whatbranch#1 branch
 ... //depot/myproject/branch_c/whatbranch#1 branch
 """,
-    '2': change_2_log +
+    2: change_2_log +
 """Affected files ...
 
 ... //depot/myproject/trunk/whatbranch#1 add
 ... //depot/otherproject/trunk/something#1 add
 """,
-    '5': change_4_log +
+    5: change_4_log +
 """Affected files ...
 
 ... //depot/myproject/branch_b/branch_b_file#1 add
@@ -108,14 +108,14 @@
 
     def _testCheck2(self, res):
         self.assertEquals(self.changes, [])
-        self.assertEquals(self.t.last_change, '1')
+        self.assertEquals(self.t.last_change, 1)
 
         # Subsequent times, it returns Change objects for new changes.
         return self.t.checkp4().addCallback(self._testCheck3)
 
     def _testCheck3(self, res):
         self.assertEquals(len(self.changes), 3)
-        self.assertEquals(self.t.last_change, '3')
+        self.assertEquals(self.t.last_change, 3)
         self.assert_(not self.t.working)
 
         # They're supposed to go oldest to newest, so this one must be first.
@@ -170,7 +170,7 @@
     def testFailedDescribe(self):
         """'p4 describe' failure is properly reported"""
         c = dict(p4change)
-        c['3'] = 'Perforce client error:\n...'
+        c[3] = 'Perforce client error:\n...'
         self.t = MockP4Source(p4changes=[first_p4changes, second_p4changes],
                               p4change=c, p4port=None, p4user=None)
         self.t.parent = self
@@ -186,7 +186,7 @@
         self.assert_(isinstance(f, failure.Failure))
         self.failUnlessIn('Perforce client error', str(f))
         self.assert_(not self.t.working)
-        self.assertEquals(self.t.last_change, '2')
+        self.assertEquals(self.t.last_change, 2)
 
     def testAlreadyWorking(self):
         """don't launch a new poll while old is still going"""
@@ -213,4 +213,4 @@
 
     def _testSplitFile(self, res):
         self.assertEquals(len(self.changes), 2)
-        self.assertEquals(self.t.last_change, '5')
+        self.assertEquals(self.t.last_change, 5)





More information about the Commits mailing list