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

Side by Side Diff: appengine/swarming/swarming_bot/api/os_utilities_test.py

Issue 2933593002: Promote 'model' from state to dimension for Macs. (Closed)
Patch Set: model -> mac_model Created 3 years, 6 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 | « appengine/swarming/swarming_bot/api/os_utilities.py ('k') | no next file » | 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 LUCI Authors. All rights reserved. 2 # Copyright 2014 The LUCI Authors. All rights reserved.
3 # Use of this source code is governed under the Apache License, Version 2.0 3 # Use of this source code is governed under the Apache License, Version 2.0
4 # that can be found in the LICENSE file. 4 # that can be found in the LICENSE file.
5 5
6 import logging 6 import logging
7 import math 7 import math
8 import os 8 import os
9 import re 9 import re
10 import subprocess 10 import subprocess
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 def test_get_dimensions(self): 92 def test_get_dimensions(self):
93 actual = set(os_utilities.get_dimensions()) 93 actual = set(os_utilities.get_dimensions())
94 # Only set on GCE. 94 # Only set on GCE.
95 actual.discard(u'machine_type') 95 actual.discard(u'machine_type')
96 actual.discard(u'zone') 96 actual.discard(u'zone')
97 # Only set on Mac. 97 # Only set on Mac.
98 actual.discard(u'hidpi') 98 actual.discard(u'hidpi')
99 expected = {u'cores', u'cpu', u'gpu', u'id', u'os', u'pool'} 99 expected = {u'cores', u'cpu', u'gpu', u'id', u'os', u'pool'}
100 if sys.platform == 'darwin': 100 if sys.platform == 'darwin':
101 expected.add(u'mac_model')
101 expected.add(u'xcode_version') 102 expected.add(u'xcode_version')
102 self.assertEqual(expected, actual) 103 self.assertEqual(expected, actual)
103 104
104 def test_get_state(self): 105 def test_get_state(self):
105 actual = os_utilities.get_state() 106 actual = os_utilities.get_state()
106 actual.pop('temp', None) 107 actual.pop('temp', None)
107 expected = { 108 expected = {
108 u'audio', u'cost_usd_hour', u'cpu_name', u'cwd', u'disks', u'gpu', u'ip', 109 u'audio', u'cost_usd_hour', u'cpu_name', u'cwd', u'disks', u'gpu', u'ip',
109 u'hostname', u'locale', u'nb_files_in_temp', u'pid', u'ram', 110 u'hostname', u'locale', u'nb_files_in_temp', u'pid', u'ram',
110 u'running_time', u'started_ts', u'uptime', u'user', 111 u'running_time', u'started_ts', u'uptime', u'user',
111 } 112 }
112 if sys.platform in ('cygwin', 'win32'): 113 if sys.platform in ('cygwin', 'win32'):
113 expected.add(u'cygwin') 114 expected.add(u'cygwin')
114 if sys.platform == 'darwin': 115 if sys.platform == 'darwin':
115 expected.add(u'model')
116 expected.add(u'xcode') 116 expected.add(u'xcode')
117 if sys.platform == 'win32': 117 if sys.platform == 'win32':
118 expected.add(u'integrity') 118 expected.add(u'integrity')
119 self.assertEqual(expected, set(actual)) 119 self.assertEqual(expected, set(actual))
120 120
121 def test_setup_auto_startup_win(self): 121 def test_setup_auto_startup_win(self):
122 # TODO(maruel): Figure out a way to test properly. 122 # TODO(maruel): Figure out a way to test properly.
123 pass 123 pass
124 124
125 def test_setup_auto_startup_osx(self): 125 def test_setup_auto_startup_osx(self):
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 self.assertFalse(os_utilities.host_reboot(timeout=60)) 160 self.assertFalse(os_utilities.host_reboot(timeout=60))
161 self.assertEqual(time.time(), 60) 161 self.assertEqual(time.time(), 60)
162 162
163 163
164 if __name__ == '__main__': 164 if __name__ == '__main__':
165 if '-v' in sys.argv: 165 if '-v' in sys.argv:
166 unittest.TestCase.maxDiff = None 166 unittest.TestCase.maxDiff = None
167 logging.basicConfig( 167 logging.basicConfig(
168 level=logging.DEBUG if '-v' in sys.argv else logging.ERROR) 168 level=logging.DEBUG if '-v' in sys.argv else logging.ERROR)
169 unittest.main() 169 unittest.main()
OLDNEW
« no previous file with comments | « appengine/swarming/swarming_bot/api/os_utilities.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698