| OLD | NEW |
| 1 # Copyright (C) 2009 Google Inc. All rights reserved. | 1 # Copyright (C) 2009 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 "sourceStamp": { | 90 "sourceStamp": { |
| 91 "revision": None, # revision=None means a trunk build start
ed from the force-build button on the builder page. | 91 "revision": None, # revision=None means a trunk build start
ed from the force-build button on the builder page. |
| 92 }, | 92 }, |
| 93 "number": int(build_number), | 93 "number": int(build_number), |
| 94 # Intentionally missing the 'results' key, meaning it's a "pass"
build. | 94 # Intentionally missing the 'results' key, meaning it's a "pass"
build. |
| 95 } | 95 } |
| 96 return build_dictionary | 96 return build_dictionary |
| 97 buildbot._fetch_build_dictionary = mock_fetch_build_dictionary | 97 buildbot._fetch_build_dictionary = mock_fetch_build_dictionary |
| 98 self.assertIsNotNone(builder._fetch_build(1)) | 98 self.assertIsNotNone(builder._fetch_build(1)) |
| 99 | 99 |
| 100 def test_results_url(self): |
| 101 builder = BuildBot().builder_with_name('WebKit Mac10.8 (dbg)') |
| 102 self.assertEqual(builder.results_url(), |
| 103 'https://storage.googleapis.com/chromium-layout-test-ar
chives/WebKit_Mac10_8__dbg_') |
| 104 |
| 105 def test_accumulated_results_url(self): |
| 106 builder = BuildBot().builder_with_name('WebKit Mac10.8 (dbg)') |
| 107 self.assertEqual(builder.accumulated_results_url(), |
| 108 'https://storage.googleapis.com/chromium-layout-test-ar
chives/WebKit_Mac10_8__dbg_/results/layout-test-results') |
| 109 |
| 100 | 110 |
| 101 class BuildBotTest(unittest.TestCase): | 111 class BuildBotTest(unittest.TestCase): |
| 102 | 112 |
| 103 _example_one_box_status = ''' | 113 _example_one_box_status = ''' |
| 104 <table> | 114 <table> |
| 105 <tr> | 115 <tr> |
| 106 <td class="box"><a href="builders/Windows%20Debug%20%28Tests%29">Windows Deb
ug (Tests)</a></td> | 116 <td class="box"><a href="builders/Windows%20Debug%20%28Tests%29">Windows Deb
ug (Tests)</a></td> |
| 107 <td align="center" class="LastBuild box success"><a href="builders/Windows
%20Debug%20%28Tests%29/builds/3693">47380</a><br />build<br />successful</td> | 117 <td align="center" class="LastBuild box success"><a href="builders/Windows
%20Debug%20%28Tests%29/builds/3693">47380</a><br />build<br />successful</td> |
| 108 <td align="center" class="Activity building">building<br />ETA in<br />~ 1
4 mins<br />at 13:40</td> | 118 <td align="center" class="Activity building">building<br />ETA in<br />~ 1
4 mins<br />at 13:40</td> |
| 109 <tr> | 119 <tr> |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 self.assertEqual(builder.keys(), expected_parsing.keys()) | 182 self.assertEqual(builder.keys(), expected_parsing.keys()) |
| 173 | 183 |
| 174 for key, expected_value in expected_parsing.items(): | 184 for key, expected_value in expected_parsing.items(): |
| 175 self.assertEqual(builder[key], expected_value, ("Builder %d pars
e failure for key: %s: Actual='%s' Expected='%s'" % (x, key, builder[key], expec
ted_value))) | 185 self.assertEqual(builder[key], expected_value, ("Builder %d pars
e failure for key: %s: Actual='%s' Expected='%s'" % (x, key, builder[key], expec
ted_value))) |
| 176 | 186 |
| 177 def test_builder_with_name(self): | 187 def test_builder_with_name(self): |
| 178 buildbot = BuildBot() | 188 buildbot = BuildBot() |
| 179 | 189 |
| 180 builder = buildbot.builder_with_name("Test Builder") | 190 builder = buildbot.builder_with_name("Test Builder") |
| 181 self.assertEqual(builder.name(), "Test Builder") | 191 self.assertEqual(builder.name(), "Test Builder") |
| 182 self.assertEqual(builder.url(), "http://build.webkit.org/builders/Test%2
0Builder") | 192 self.assertEqual(builder.url(), "http://build.chromium.org/p/chromium.we
bkit/builders/Test%20Builder") |
| 183 self.assertEqual(builder.url_encoded_name(), "Test%20Builder") | 193 self.assertEqual(builder.url_encoded_name(), "Test%20Builder") |
| 184 self.assertEqual(builder.results_url(), "http://build.webkit.org/results
/Test%20Builder") | 194 self.assertEqual(builder.results_url(), "https://storage.googleapis.com/
chromium-layout-test-archives/Test_Builder") |
| 185 | 195 |
| 186 # Override _fetch_build_dictionary function to not touch the network. | 196 # Override _fetch_build_dictionary function to not touch the network. |
| 187 def mock_fetch_build_dictionary(self, build_number): | 197 def mock_fetch_build_dictionary(self, build_number): |
| 188 build_dictionary = { | 198 build_dictionary = { |
| 189 "sourceStamp": { | 199 "sourceStamp": { |
| 190 "revision" : 2 * build_number, | 200 "revision" : 2 * build_number, |
| 191 }, | 201 }, |
| 192 "number" : int(build_number), | 202 "number" : int(build_number), |
| 193 "results" : build_number % 2, # 0 means pass | 203 "results" : build_number % 2, # 0 means pass |
| 194 } | 204 } |
| 195 return build_dictionary | 205 return build_dictionary |
| 196 buildbot._fetch_build_dictionary = mock_fetch_build_dictionary | 206 buildbot._fetch_build_dictionary = mock_fetch_build_dictionary |
| 197 | 207 |
| 198 build = builder.build(10) | 208 build = builder.build(10) |
| 199 self.assertEqual(build.builder(), builder) | 209 self.assertEqual(build.builder(), builder) |
| 200 self.assertEqual(build.url(), "http://build.webkit.org/builders/Test%20B
uilder/builds/10") | 210 self.assertEqual(build.url(), "http://build.chromium.org/p/chromium.webk
it/builders/Test%20Builder/builds/10") |
| 201 self.assertEqual(build.results_url(), "http://build.webkit.org/results/T
est%20Builder/r20%20%2810%29") | 211 self.assertEqual(build.results_url(), "https://storage.googleapis.com/ch
romium-layout-test-archives/Test_Builder/r20%20%2810%29") |
| 202 self.assertEqual(build.revision(), 20) | 212 self.assertEqual(build.revision(), 20) |
| 203 self.assertTrue(build.is_green()) | 213 self.assertTrue(build.is_green()) |
| 204 | 214 |
| 205 build = build.previous_build() | 215 build = build.previous_build() |
| 206 self.assertEqual(build.builder(), builder) | 216 self.assertEqual(build.builder(), builder) |
| 207 self.assertEqual(build.url(), "http://build.webkit.org/builders/Test%20B
uilder/builds/9") | 217 self.assertEqual(build.url(), "http://build.chromium.org/p/chromium.webk
it/builders/Test%20Builder/builds/9") |
| 208 self.assertEqual(build.results_url(), "http://build.webkit.org/results/T
est%20Builder/r18%20%289%29") | 218 self.assertEqual(build.results_url(), "https://storage.googleapis.com/ch
romium-layout-test-archives/Test_Builder/r18%20%289%29") |
| 209 self.assertEqual(build.revision(), 18) | 219 self.assertEqual(build.revision(), 18) |
| 210 self.assertFalse(build.is_green()) | 220 self.assertFalse(build.is_green()) |
| 211 | 221 |
| 212 self.assertIsNone(builder.build(None)) | 222 self.assertIsNone(builder.build(None)) |
| 213 | 223 |
| 214 _example_directory_listing = ''' | 224 _example_directory_listing = ''' |
| 215 <h1>Directory listing for /results/SnowLeopard Intel Leaks/</h1> | 225 <h1>Directory listing for /results/SnowLeopard Intel Leaks/</h1> |
| 216 | 226 |
| 217 <table> | 227 <table> |
| 218 <tr class="alt"> | 228 <tr class="alt"> |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 b._fetch_revision_to_build_map = self._fetch_revision_to_build_map | 413 b._fetch_revision_to_build_map = self._fetch_revision_to_build_map |
| 404 self.assertEqual("correct build", b.latest_cached_build()) | 414 self.assertEqual("correct build", b.latest_cached_build()) |
| 405 | 415 |
| 406 def results_url(self): | 416 def results_url(self): |
| 407 return "some-url" | 417 return "some-url" |
| 408 | 418 |
| 409 def test_results_zip_url(self): | 419 def test_results_zip_url(self): |
| 410 b = Build(None, 123, 123, False) | 420 b = Build(None, 123, 123, False) |
| 411 b.results_url = self.results_url | 421 b.results_url = self.results_url |
| 412 self.assertEqual("some-url.zip", b.results_zip_url()) | 422 self.assertEqual("some-url.zip", b.results_zip_url()) |
| OLD | NEW |