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

Side by Side Diff: infra/libs/buildbot/test/master_test.py

Issue 1128783003: Add master_manager_launch script which launches master_manager scripts for each master on a host. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Move to infra/services. Created 5 years, 7 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 unified diff | Download patch
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import collections 5 import collections
6 import json 6 import json
7 import os 7 import os
8 import requests 8 import requests
9 import simplejson 9 import simplejson
10 import subprocess 10 import subprocess
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 raise requests.exceptions.Timeout('timeout') 148 raise requests.exceptions.Timeout('timeout')
149 self.mock(requests, 'get', timeout) 149 self.mock(requests, 'get', timeout)
150 self.assertIsNone(master.get_accepting_builds(self.chromium_fyi)) 150 self.assertIsNone(master.get_accepting_builds(self.chromium_fyi))
151 151
152 def testConnectionErr(self): 152 def testConnectionErr(self):
153 def timeout(*_args, **_kwargs): 153 def timeout(*_args, **_kwargs):
154 raise requests.exceptions.ConnectionError('error') 154 raise requests.exceptions.ConnectionError('error')
155 self.mock(requests, 'get', timeout) 155 self.mock(requests, 'get', timeout)
156 self.assertIsNone(master.get_accepting_builds(self.chromium_fyi)) 156 self.assertIsNone(master.get_accepting_builds(self.chromium_fyi))
157 157
158 def testMastermapHost(self):
159 masters = [
160 {'fullhost': 'bananas.cool'},
161 {'fullhost': 'bananas.cool'},
162 {'fullhost': 'bananas_dos.cool'},
163 ]
164 self.mock(master, '_call_mastermap', lambda _x: masters)
165
166 self.assertEqual(
167 len(master.get_mastermap_for_host('fake', 'bananas.cool')),
168 2)
169
158 class TestMasterManipulation(auto_stub.TestCase): 170 class TestMasterManipulation(auto_stub.TestCase):
159 def setUp(self): 171 def setUp(self):
160 super(TestMasterManipulation, self).setUp() 172 super(TestMasterManipulation, self).setUp()
161 self.chromium_fyi = os.path.join(DATA_DIR, 'master.chromium.fyi') 173 self.chromium_fyi = os.path.join(DATA_DIR, 'master.chromium.fyi')
162 174
163 def testWithGclientSyncEnabled(self): 175 def testWithGclientSyncEnabled(self):
164 actions = list(master.convert_action_items_to_cli(( 176 actions = list(master.convert_action_items_to_cli((
165 master.GclientSync, 177 master.GclientSync,
166 master.MakeStop, 178 master.MakeStop,
167 master.MakeWait, 179 master.MakeWait,
(...skipping 21 matching lines...) Expand all
189 self.assertEquals( 201 self.assertEquals(
190 [a['cmd'] for a in actions], 202 [a['cmd'] for a in actions],
191 [ 203 [
192 ['make', 'stop'], 204 ['make', 'stop'],
193 ], 205 ],
194 ) 206 )
195 207
196 def testInvalid(self): 208 def testInvalid(self):
197 with self.assertRaises(ValueError): 209 with self.assertRaises(ValueError):
198 list(master.convert_action_items_to_cli((-100,), self.chromium_fyi)) 210 list(master.convert_action_items_to_cli((-100,), self.chromium_fyi))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698