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

Side by Side Diff: scripts/tools/unittests/mastermap_test.py

Issue 1688043003: Move master_port_alts from 40000 to 25000 so they don't overlap with ephemeral ports (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Raise an exception if asked to compose a port outside the range Created 4 years, 10 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
« no previous file with comments | « scripts/tools/mastermap.py ('k') | site_config/config_default.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Tests for scripts/tools/mastermap.py""" 6 """Tests for scripts/tools/mastermap.py"""
7 7
8 8
9 import json 9 import json
10 import unittest 10 import unittest
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 self.assertEquals(output.data[0]['master_base_class'], 'Master1') 98 self.assertEquals(output.data[0]['master_base_class'], 'Master1')
99 99
100 def test_skip_used_ports(self): 100 def test_skip_used_ports(self):
101 masters = self._gen_masters(5) 101 masters = self._gen_masters(5)
102 master_class_name = 'Master1' 102 master_class_name = 'Master1'
103 output = FakeOutput() 103 output = FakeOutput()
104 mastermap.find_port(master_class_name, masters, output, FakeOpts()) 104 mastermap.find_port(master_class_name, masters, output, FakeOpts())
105 self.assertEquals(output.data, [ { 105 self.assertEquals(output.data, [ {
106 u'master_base_class': u'Master1', 106 u'master_base_class': u'Master1',
107 u'master_port': u'20105', 107 u'master_port': u'20105',
108 u'master_port_alt': u'40105', 108 u'master_port_alt': u'25105',
109 u'slave_port': u'30105', 109 u'slave_port': u'30105',
110 } ]) 110 } ])
111 111
112 def test_skip_blacklisted_ports(self): 112 def test_skip_blacklisted_ports(self):
113 masters = [{'name': 'Master1', 'fullhost': 'master1.golo.chromium.org'}] 113 masters = [{'name': 'Master1', 'fullhost': 'master1.golo.chromium.org'}]
114 master_class_name = 'Master1' 114 master_class_name = 'Master1'
115 output = FakeOutput() 115 output = FakeOutput()
116 _real_blacklist = mastermap.PORT_BLACKLIST 116 _real_blacklist = mastermap.PORT_BLACKLIST
117 try: 117 try:
118 mastermap.PORT_BLACKLIST = set(xrange(40000, 50000)) # All alt_ports 118 mastermap.PORT_BLACKLIST = set(xrange(25000, 30000)) # All alt_ports
119 self.assertRaises(RuntimeError, mastermap.find_port, 119 self.assertRaises(RuntimeError, mastermap.find_port,
120 master_class_name, masters, output, FakeOpts()) 120 master_class_name, masters, output, FakeOpts())
121 finally: 121 finally:
122 mastermap.PORT_BLACKLIST = _real_blacklist 122 mastermap.PORT_BLACKLIST = _real_blacklist
123 123
124 124
125 class AuditTest(unittest.TestCase): 125 class AuditTest(unittest.TestCase):
126 # TODO(agable): Actually test this. 126 # TODO(agable): Actually test this.
127 pass 127 pass
128 128
129 129
130 if __name__ == '__main__': 130 if __name__ == '__main__':
131 unittest.TestCase.maxDiff = None 131 unittest.TestCase.maxDiff = None
132 unittest.main() 132 unittest.main()
OLDNEW
« no previous file with comments | « scripts/tools/mastermap.py ('k') | site_config/config_default.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698