summaryrefslogtreecommitdiff
path: root/cbuildbot/cbuildbot_config_unittest.py
diff options
context:
space:
mode:
authorDavid James <davidjames@google.com>2015-04-01 15:23:28 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-04-03 06:15:22 +0000
commit3e0d698446e2962ca4f75c780a9a1975c496debb (patch)
treee6c1539487b7f8d2de39305bacbd548fd4be3321 /cbuildbot/cbuildbot_config_unittest.py
parent0b53c2e7ca17b18e8d9e7041cf6817f4c6483d8e (diff)
downloadchromite-3e0d698446e2962ca4f75c780a9a1975c496debb.tar.gz
Re-land "completion_stages: Don't check the master for critical stages."
This fixes board-aware submission. Differences from the first CL: 1. I've moved the definition of "all_slaves" to the one place it is used, and this allows me to use GetSlaveConfigs, which is only valid for CQ masters. 2. all_slaves is a set now (as it should be). 3. I've added more tests for CommitQueueCompletionStage here that run through all logic in both the master and slave cases. Previously our tests only tested a single method and not the whole PerformStage method. BUG=chromium:472533 TEST=New unit tests. Trybot runs of both master and slave. Original-Change-Id: Ie7839a547cb74c85988cc2f67817842487026c53 Originally-Reviewed-on: https://chromium-review.googlesource.com/263560 Change-Id: Ia949acffa09c28a7340f4248a369495d05d540f6 Reviewed-on: https://chromium-review.googlesource.com/263692 Reviewed-by: David James <davidjames@chromium.org> Commit-Queue: David James <davidjames@chromium.org> Tested-by: David James <davidjames@chromium.org>
Diffstat (limited to 'cbuildbot/cbuildbot_config_unittest.py')
-rw-r--r--cbuildbot/cbuildbot_config_unittest.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/cbuildbot/cbuildbot_config_unittest.py b/cbuildbot/cbuildbot_config_unittest.py
index 4d260575b..6d9fb808c 100644
--- a/cbuildbot/cbuildbot_config_unittest.py
+++ b/cbuildbot/cbuildbot_config_unittest.py
@@ -385,13 +385,24 @@ class CBuildBotTest(cros_test_lib.TestCase):
def testGetSlaves(self):
"""Make sure every master has a sane list of slaves"""
for build_name, config in cbuildbot_config.config.iteritems():
- if config['master']:
+ if config.master:
configs = cbuildbot_config.GetSlavesForMaster(config)
self.assertEqual(
len(map(repr, configs)), len(set(map(repr, configs))),
'Duplicate board in slaves of %s will cause upload prebuilts'
' failures' % build_name)
+ # Our logic for calculating what slaves have completed their critical
+ # stages will break if the master is considered a slave of itself,
+ # because db.GetSlaveStages(...) doesn't include master stages.
+ if config.build_type == constants.PALADIN_TYPE:
+ self.assertEquals(
+ config.boards, [],
+ 'Master paladin %s cannot have boards.' % build_name)
+ self.assertNotIn(
+ build_name, [x.name for x in configs],
+ 'Master paladin %s cannot be a slave of itself.' % build_name)
+
def testGetSlavesOnTrybot(self):
"""Make sure every master has a sane list of slaves"""
mock_options = mock.Mock()