Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1461)

Unified Diff: buildbot/cbuildbot_commands_unittest.py

Issue 6771036: Change RepoSync to use -j4 option. Add tests to check for retries. (Closed) Base URL: http://git.chromium.org/git/chromite.git@master
Patch Set: Add custom-retry-pass test and comments. Fix line length. Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« buildbot/cbuildbot_commands.py ('K') | « buildbot/cbuildbot_commands.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: buildbot/cbuildbot_commands_unittest.py
diff --git a/buildbot/cbuildbot_commands_unittest.py b/buildbot/cbuildbot_commands_unittest.py
index 5ae8ecc413219b3f3053ae88633a0dff89b8f7f9..f719fb9fe559884825fcc24ae84280f1ad148ab1 100755
--- a/buildbot/cbuildbot_commands_unittest.py
+++ b/buildbot/cbuildbot_commands_unittest.py
@@ -109,6 +109,54 @@ class CBuildBotTest(mox.MoxTestBase):
binhosts, 'chrome', 'tot')
self.mox.VerifyAll()
+ def testRepoSyncRetriesFail(self):
+ """Case where we exceed default retry attempts"""
davidjames 2011/04/01 20:20:27 Please add a trailing period.
rcui1 2011/04/01 20:44:08 Done.
+ cros_lib.OldRunCommand(mox.In('sync'),
+ cwd=self._buildroot).AndRaise(Exception("failed"))
+ cros_lib.OldRunCommand(mox.In('sync'),
+ cwd=self._buildroot).AndRaise(Exception("failed"))
+ cros_lib.OldRunCommand(mox.In('sync'),
+ cwd=self._buildroot).AndRaise(Exception("failed"))
+ self.mox.ReplayAll()
+ self.assertRaises(Exception, lambda : commands._RepoSync(self._buildroot))
davidjames 2011/04/01 20:20:27 No need for the space between 'lambda' and ':'. (
rcui1 2011/04/01 20:44:08 Done.
+ self.mox.VerifyAll()
+
+ def testRepoSyncRetriesPass(self):
+ """Case where we fail twice and pass on the third try."""
+ cros_lib.OldRunCommand(mox.In('sync'),
+ cwd=self._buildroot).AndRaise(Exception("failed"))
+ cros_lib.OldRunCommand(mox.In('sync'),
+ cwd=self._buildroot).AndRaise(Exception("failed"))
+ cros_lib.OldRunCommand(mox.In('sync'), cwd=self._buildroot)
+ cros_lib.OldRunCommand(mox.In('forall'), cwd=self._buildroot)
+ cros_lib.OldRunCommand(mox.In('manifest'), cwd=self._buildroot)
+ self.mox.ReplayAll()
+ commands._RepoSync(self._buildroot)
+ self.mox.VerifyAll()
+
+ def testRepoSyncCustomRetriesFail(self):
+ """Case where _RepoSync is called with a custom retry value of 1. Should
+ throw exception after first failure."""
+ cros_lib.OldRunCommand(mox.In('sync'),
+ cwd=self._buildroot).AndRaise(Exception("failed"))
+ self.mox.ReplayAll()
+ self.assertRaises(
+ Exception,
+ lambda : commands._RepoSync(self._buildroot, retries=1))
davidjames 2011/04/01 20:20:27 Ditto.
rcui1 2011/04/01 20:44:08 Done.
+ self.mox.VerifyAll()
+
+ def testRepoSyncCustomRetriesPass(self):
+ """Case where _RepoSync is called with a custom retry value of 2 and passes
+ the second time."""
+ cros_lib.OldRunCommand(mox.In('sync'),
+ cwd=self._buildroot).AndRaise(Exception("failed"))
+ cros_lib.OldRunCommand(mox.In('sync'), cwd=self._buildroot)
+ cros_lib.OldRunCommand(mox.In('forall'), cwd=self._buildroot)
+ cros_lib.OldRunCommand(mox.In('manifest'), cwd=self._buildroot)
+ self.mox.ReplayAll()
+ commands._RepoSync(self._buildroot, retries=2)
+ self.mox.VerifyAll()
+
if __name__ == '__main__':
unittest.main()
« buildbot/cbuildbot_commands.py ('K') | « buildbot/cbuildbot_commands.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698