Commits

Anonymous committed cbc8a0c

Add tests for bzr baseURL; fix combining baseURL w/ branch.

Comments (0)

Files changed (2)

master/buildbot/steps/source/bzr.py

         self.stdio_log = self.addLog("stdio")
 
         if self.repourl is None:
-            self.repourl = self.baseURL + self.branch
+            if self.baseURL[-1] == '/':
+                self.repourl = self.baseURL + self.branch
+            else:
+                self.repourl = self.baseURL +'/' + self.branch
 
         d = self.checkBzr()
         def checkInstall(bzrInstalled):

master/buildbot/test/unit/test_steps_source_bzr.py

         return self.runStep()
 
 
+    def test_mode_full_clobber_baseurl(self):
+        self.setupStep(
+            bzr.Bzr(baseURL='http://bzr.squid-cache.org/bzr/squid3',
+                    defaultBranch='trunk', mode='full', method='clobber'))
+        self.expectCommands(
+            ExpectShell(workdir='wkdir',
+                        command=['bzr', '--version'])
+            + 0,
+            Expect('rmdir', dict(dir='wkdir',
+                                 logEnviron=True))
+            + 0,
+            ExpectShell(workdir='wkdir',
+                        command=['bzr', 'checkout',
+                                'http://bzr.squid-cache.org/bzr/squid3/trunk', '.'])
+            + 0,
+            ExpectShell(workdir='wkdir',
+                        command=['bzr', 'version-info', '--custom', "--template='{revno}"])
+            + ExpectShell.log('stdio',
+                stdout='100')
+            + 0,
+                    )
+        self.expectOutcome(result=SUCCESS, status_text=["update"])
+        return self.runStep()
+
+
+    def test_mode_full_clobber_baseurl_nodefault(self):
+        self.setupStep(
+            bzr.Bzr(baseURL='http://bzr.squid-cache.org/bzr/squid3',
+                    defaultBranch='trunk', mode='full', method='clobber'),
+            args=dict(branch='branches/SQUID_3_0'))
+        self.expectCommands(
+            ExpectShell(workdir='wkdir',
+                        command=['bzr', '--version'])
+            + 0,
+            Expect('rmdir', dict(dir='wkdir',
+                                 logEnviron=True))
+            + 0,
+            ExpectShell(workdir='wkdir',
+                        command=['bzr', 'checkout',
+                                'http://bzr.squid-cache.org/bzr/squid3/branches/SQUID_3_0', '.'])
+            + 0,
+            ExpectShell(workdir='wkdir',
+                        command=['bzr', 'version-info', '--custom', "--template='{revno}"])
+            + ExpectShell.log('stdio',
+                stdout='100')
+            + 0,
+                    )
+        self.expectOutcome(result=SUCCESS, status_text=["update"])
+        return self.runStep()
+
+
     def test_mode_full_copy(self):
         self.setupStep(
             bzr.Bzr(repourl='http://bzr.squid-cache.org/bzr/squid3/trunk',