OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 unittest | 5 import unittest |
6 | 6 |
7 import mock | 7 import mock |
8 | 8 |
9 from dashboard.pinpoint.models.quest import run_test | 9 from dashboard.pinpoint.models.quest import run_test |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 ] | 25 ] |
26 | 26 |
27 | 27 |
28 class _RunTestTest(unittest.TestCase): | 28 class _RunTestTest(unittest.TestCase): |
29 | 29 |
30 def assertNewTaskHasDimensions(self, swarming_tasks_new): | 30 def assertNewTaskHasDimensions(self, swarming_tasks_new): |
31 body = { | 31 body = { |
32 'name': 'Pinpoint job', | 32 'name': 'Pinpoint job', |
33 'user': 'Pinpoint', | 33 'user': 'Pinpoint', |
34 'priority': '100', | 34 'priority': '100', |
35 'expiration_secs': '600', | 35 'expiration_secs': '36000', |
36 'properties': { | 36 'properties': { |
37 'inputs_ref': {'isolated': 'input isolate hash'}, | 37 'inputs_ref': {'isolated': 'input isolate hash'}, |
38 'extra_args': _SWARMING_EXTRA_ARGS, | 38 'extra_args': _SWARMING_EXTRA_ARGS, |
39 'dimensions': [{'key': 'pool', 'value': 'Chrome-perf-pinpoint'}] + | 39 'dimensions': [{'key': 'pool', 'value': 'Chrome-perf-pinpoint'}] + |
40 _SWARMING_DIMENSIONS, | 40 _SWARMING_DIMENSIONS, |
41 'execution_timeout_secs': '3600', | 41 'execution_timeout_secs': '7200', |
42 'io_timeout_secs': '3600', | 42 'io_timeout_secs': '3600', |
43 }, | 43 }, |
44 } | 44 } |
45 swarming_tasks_new.assert_called_with(body) | 45 swarming_tasks_new.assert_called_with(body) |
46 | 46 |
47 def assertNewTaskHasBotId(self, swarming_tasks_new): | 47 def assertNewTaskHasBotId(self, swarming_tasks_new): |
48 body = { | 48 body = { |
49 'name': 'Pinpoint job', | 49 'name': 'Pinpoint job', |
50 'user': 'Pinpoint', | 50 'user': 'Pinpoint', |
51 'priority': '100', | 51 'priority': '100', |
52 'expiration_secs': '600', | 52 'expiration_secs': '36000', |
53 'properties': { | 53 'properties': { |
54 'inputs_ref': {'isolated': 'input isolate hash'}, | 54 'inputs_ref': {'isolated': 'input isolate hash'}, |
55 'extra_args': _SWARMING_EXTRA_ARGS, | 55 'extra_args': _SWARMING_EXTRA_ARGS, |
56 'dimensions': [ | 56 'dimensions': [ |
57 {'key': 'pool', 'value': 'Chrome-perf-pinpoint'}, | 57 {'key': 'pool', 'value': 'Chrome-perf-pinpoint'}, |
58 {'key': 'id', 'value': 'bot id'}, | 58 {'key': 'id', 'value': 'bot id'}, |
59 ], | 59 ], |
60 'execution_timeout_secs': '3600', | 60 'execution_timeout_secs': '7200', |
61 'io_timeout_secs': '3600', | 61 'io_timeout_secs': '3600', |
62 }, | 62 }, |
63 } | 63 } |
64 swarming_tasks_new.assert_called_with(body) | 64 swarming_tasks_new.assert_called_with(body) |
65 | 65 |
66 | 66 |
67 @mock.patch('dashboard.services.swarming_service.Tasks.New') | 67 @mock.patch('dashboard.services.swarming_service.Tasks.New') |
68 @mock.patch('dashboard.services.swarming_service.Task.Result') | 68 @mock.patch('dashboard.services.swarming_service.Task.Result') |
69 class RunTestFullTest(_RunTestTest): | 69 class RunTestFullTest(_RunTestTest): |
70 | 70 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 'bot_id': 'bot id', | 214 'bot_id': 'bot id', |
215 'exit_code': 0, | 215 'exit_code': 0, |
216 'failure': False, | 216 'failure': False, |
217 'outputs_ref': {'isolated': 'output isolate hash'}, | 217 'outputs_ref': {'isolated': 'output isolate hash'}, |
218 'state': 'COMPLETED', | 218 'state': 'COMPLETED', |
219 } | 219 } |
220 execution_1.Poll() | 220 execution_1.Poll() |
221 execution_2.Poll() | 221 execution_2.Poll() |
222 | 222 |
223 self.assertEqual(swarming_tasks_new.call_count, 2) | 223 self.assertEqual(swarming_tasks_new.call_count, 2) |
OLD | NEW |