| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 'outputs_ref': {'isolated': 'output isolate hash'}, | 102 'outputs_ref': {'isolated': 'output isolate hash'}, |
| 103 'state': 'COMPLETED', | 103 'state': 'COMPLETED', |
| 104 } | 104 } |
| 105 execution.Poll() | 105 execution.Poll() |
| 106 | 106 |
| 107 self.assertTrue(execution.completed) | 107 self.assertTrue(execution.completed) |
| 108 self.assertFalse(execution.failed) | 108 self.assertFalse(execution.failed) |
| 109 self.assertEqual(execution.result_values, (None,)) | 109 self.assertEqual(execution.result_values, (None,)) |
| 110 self.assertEqual(execution.result_arguments, | 110 self.assertEqual(execution.result_arguments, |
| 111 {'isolate_hash': 'output isolate hash'}) | 111 {'isolate_hash': 'output isolate hash'}) |
| 112 self.assertEqual( |
| 113 { |
| 114 'bot_id': 'bot id', |
| 115 'input_isolate_hash': 'input isolate hash', |
| 116 'task_id': 'task id', |
| 117 'result_arguments': {'isolate_hash': 'output isolate hash'}, |
| 118 'result_values': (None,), |
| 119 }, |
| 120 execution.AsDict()) |
| 121 |
| 112 | 122 |
| 113 # Start a second Execution to check bot_id handling. We get a bot_id from | 123 # Start a second Execution to check bot_id handling. We get a bot_id from |
| 114 # Swarming from the first Execution and reuse it in subsequent Executions. | 124 # Swarming from the first Execution and reuse it in subsequent Executions. |
| 115 execution = quest.Start('input isolate hash') | 125 execution = quest.Start('input isolate hash') |
| 116 execution.Poll() | 126 execution.Poll() |
| 117 | 127 |
| 118 self.assertNewTaskHasBotId(swarming_tasks_new) | 128 self.assertNewTaskHasBotId(swarming_tasks_new) |
| 119 | 129 |
| 120 | 130 |
| 121 @mock.patch('dashboard.services.swarming_service.Tasks.New') | 131 @mock.patch('dashboard.services.swarming_service.Tasks.New') |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 'bot_id': 'bot id', | 224 'bot_id': 'bot id', |
| 215 'exit_code': 0, | 225 'exit_code': 0, |
| 216 'failure': False, | 226 'failure': False, |
| 217 'outputs_ref': {'isolated': 'output isolate hash'}, | 227 'outputs_ref': {'isolated': 'output isolate hash'}, |
| 218 'state': 'COMPLETED', | 228 'state': 'COMPLETED', |
| 219 } | 229 } |
| 220 execution_1.Poll() | 230 execution_1.Poll() |
| 221 execution_2.Poll() | 231 execution_2.Poll() |
| 222 | 232 |
| 223 self.assertEqual(swarming_tasks_new.call_count, 2) | 233 self.assertEqual(swarming_tasks_new.call_count, 2) |
| OLD | NEW |