OLD | NEW |
---|---|
1 #!/usr/bin/env python | |
ojan
2014/06/09 21:39:16
Removed this to make presubmit happy. Presumably I
| |
2 # Copyright (C) 2012 Google Inc. All rights reserved. | 1 # Copyright (C) 2012 Google Inc. All rights reserved. |
3 # | 2 # |
4 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
5 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
6 # met: | 5 # met: |
7 # | 6 # |
8 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
9 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
10 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
11 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
89 if url == 'http://build.chromium.org/p/chromium.webkit/json/buil ders/WebKit%20Linux': | 88 if url == 'http://build.chromium.org/p/chromium.webkit/json/buil ders/WebKit%20Linux': |
90 return {'cachedBuilds': [1, 2], 'currentBuilds': []} | 89 return {'cachedBuilds': [1, 2], 'currentBuilds': []} |
91 if url == 'http://build.chromium.org/p/chromium.webkit/json/buil ders/WebKit%20Win': | 90 if url == 'http://build.chromium.org/p/chromium.webkit/json/buil ders/WebKit%20Win': |
92 return {'cachedBuilds': [1, 2], 'currentBuilds': []} | 91 return {'cachedBuilds': [1, 2], 'currentBuilds': []} |
93 if url == 'http://build.chromium.org/p/chromium.webkit/json/buil ders/WebKit%20Mac': | 92 if url == 'http://build.chromium.org/p/chromium.webkit/json/buil ders/WebKit%20Mac': |
94 return {'cachedBuilds': [1, 2], 'currentBuilds': []} | 93 return {'cachedBuilds': [1, 2], 'currentBuilds': []} |
95 if url == 'http://build.chromium.org/p/chromium.webkit/json/buil ders/WebKit%20Empty': | 94 if url == 'http://build.chromium.org/p/chromium.webkit/json/buil ders/WebKit%20Empty': |
96 return {'cachedBuilds': [], 'currentBuilds': []} | 95 return {'cachedBuilds': [], 'currentBuilds': []} |
97 | 96 |
98 if url == 'http://build.chromium.org/p/chromium.webkit/json/buil ders/WebKit%20Linux/builds/2': | 97 if url == 'http://build.chromium.org/p/chromium.webkit/json/buil ders/WebKit%20Linux/builds/2': |
99 return {'steps': [{'name': 'webkit_tests'}, {'name': 'browse r_tests'}, {'name': 'mini_installer_test'}, {'name': 'archive_test_results'}, {' name': 'compile'}]} | 98 return {'steps': [{'name': 'foo_tests_only'}, {'name': 'webk it_tests'}, {'name': 'browser_tests'}, {'name': 'mini_installer_test'}, {'name': 'archive_test_results'}, {'name': 'compile'}]} |
100 if url == 'http://build.chromium.org/p/chromium.webkit/json/buil ders/WebKit%20Win/builds/2': | 99 if url == 'http://build.chromium.org/p/chromium.webkit/json/buil ders/WebKit%20Win/builds/2': |
101 return {'steps': [{'name': 'webkit_tests'}, {'name': 'mini_i nstaller_test'}, {'name': 'archive_test_results'}, {'name': 'compile'}]} | 100 return {'steps': [{'name': 'foo_tests_ignore'}, {'name': 'we bkit_tests'}, {'name': 'mini_installer_test'}, {'name': 'archive_test_results'}, {'name': 'compile'}]} |
102 if url == 'http://build.chromium.org/p/chromium.webkit/json/buil ders/WebKit%20Mac/builds/2': | 101 if url == 'http://build.chromium.org/p/chromium.webkit/json/buil ders/WebKit%20Mac/builds/2': |
103 return {'steps': [{'name': 'browser_tests'}, {'name': 'mini_ installer_test'}, {'name': 'archive_test_results'}, {'name': 'compile'}]} | 102 return {'steps': [{'name': 'foo_tests_perf'}, {'name': 'brow ser_tests'}, {'name': 'mini_installer_test'}, {'name': 'archive_test_results'}, {'name': 'compile'}]} |
104 | 103 |
105 logging.error('Cannot fetch fake url: %s' % url) | 104 logging.error('Cannot fetch fake url: %s' % url) |
106 | 105 |
107 old_fetch_json = buildershandler.fetch_json | 106 old_fetch_json = buildershandler.fetch_json |
108 buildershandler.fetch_json = fake_fetch_json | 107 buildershandler.fetch_json = fake_fetch_json |
109 | 108 |
110 masters = [ | 109 masters = [ |
111 {'name': 'ChromiumWebkit', 'url': 'http://build.chromium.org/p/c hromium.webkit'}, | 110 {'name': 'ChromiumWebkit', 'url': 'http://build.chromium.org/p/c hromium.webkit'}, |
112 ] | 111 ] |
113 | 112 |
(...skipping 11 matching lines...) Expand all Loading... | |
125 ] | 124 ] |
126 self.assertEqual(set(fetched_urls), set(expected_fetched_urls)) | 125 self.assertEqual(set(fetched_urls), set(expected_fetched_urls)) |
127 | 126 |
128 expected_masters = { | 127 expected_masters = { |
129 'masters': [{ | 128 'masters': [{ |
130 'url': 'http://build.chromium.org/p/chromium.webkit', | 129 'url': 'http://build.chromium.org/p/chromium.webkit', |
131 'tests': { | 130 'tests': { |
132 'browser_tests': {'builders': ['WebKit Linux', 'WebKit M ac']}, | 131 'browser_tests': {'builders': ['WebKit Linux', 'WebKit M ac']}, |
133 'mini_installer_test': {'builders': ['WebKit Linux', 'We bKit Mac', 'WebKit Win']}, | 132 'mini_installer_test': {'builders': ['WebKit Linux', 'We bKit Mac', 'WebKit Win']}, |
134 'layout-tests': {'builders': ['WebKit Linux', 'WebKit Wi n']}}, | 133 'layout-tests': {'builders': ['WebKit Linux', 'WebKit Wi n']}}, |
135 'name': 'ChromiumWebkit'}]} | 134 'name': 'ChromiumWebkit'}], |
135 "no_upload_test_types": buildershandler.TEST_STEPS_THAT_DO_NOT_U PLOAD_YET, | |
136 } | |
136 expected_json = buildershandler.dump_json(expected_masters) | 137 expected_json = buildershandler.dump_json(expected_masters) |
137 | 138 |
138 self.assertEqual(buildbot_data, expected_json) | 139 self.assertEqual(buildbot_data, expected_json) |
139 finally: | 140 finally: |
140 buildershandler.fetch_json = old_fetch_json | 141 buildershandler.fetch_json = old_fetch_json |
141 | 142 |
142 def test_fetch_buildbot_data_failure(self): | 143 def test_fetch_buildbot_data_failure(self): |
143 try: | 144 try: |
144 fetched_urls = [] | 145 fetched_urls = [] |
145 | 146 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
198 ] | 199 ] |
199 with self.assertRaises(buildershandler.FetchBuildersException): | 200 with self.assertRaises(buildershandler.FetchBuildersException): |
200 buildbot_data = buildershandler.fetch_buildbot_data(masters) | 201 buildbot_data = buildershandler.fetch_buildbot_data(masters) |
201 self.assertEqual(set(expected_fetched_urls), set(fetched_urls)) | 202 self.assertEqual(set(expected_fetched_urls), set(fetched_urls)) |
202 self.assertNotEqual(set(fetched_urls), set(fetched_urls_all)) | 203 self.assertNotEqual(set(fetched_urls), set(fetched_urls_all)) |
203 | 204 |
204 finally: | 205 finally: |
205 buildershandler.fetch_json = old_fetch_json | 206 buildershandler.fetch_json = old_fetch_json |
206 | 207 |
207 | 208 |
208 | |
209 if __name__ == '__main__': | 209 if __name__ == '__main__': |
210 unittest.main() | 210 unittest.main() |
OLD | NEW |