| 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 time | 5 import time |
| 6 | 6 |
| 7 from model import analysis_status | 7 from model import analysis_status |
| 8 from model.flake.flake_swarming_task import FlakeSwarmingTask | 8 from model.flake.flake_swarming_task import FlakeSwarmingTask |
| 9 from model.wf_swarming_task import WfSwarmingTask | 9 from model.wf_swarming_task import WfSwarmingTask |
| 10 from waterfall import swarming_util | 10 from waterfall import swarming_util |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 'priority': 25, | 79 'priority': 25, |
| 80 'properties': { | 80 'properties': { |
| 81 'command': 'cmd', | 81 'command': 'cmd', |
| 82 'dimensions': [{'key': 'k', 'value': 'v'}], | 82 'dimensions': [{'key': 'k', 'value': 'v'}], |
| 83 'env': [ | 83 'env': [ |
| 84 {'key': 'a', 'value': '1'}, | 84 {'key': 'a', 'value': '1'}, |
| 85 {'key': 'GTEST_SHARD_INDEX', 'value': '1'}, | 85 {'key': 'GTEST_SHARD_INDEX', 'value': '1'}, |
| 86 {'key': 'GTEST_TOTAL_SHARDS', 'value': '5'}, | 86 {'key': 'GTEST_TOTAL_SHARDS', 'value': '5'}, |
| 87 ], | 87 ], |
| 88 'execution_timeout_secs': 3600, | 88 'execution_timeout_secs': 3600, |
| 89 'extra_args': ['--flag=value', '--gtest_filter=d.f'], | 89 'extra_args': [ |
| 90 '--flag=value', |
| 91 '--gtest_filter=d.f', |
| 92 '--test-launcher-filter-file=path/to/filter/file', |
| 93 ], |
| 90 'grace_period_secs': 30, | 94 'grace_period_secs': 30, |
| 91 'idempotent': True, | 95 'idempotent': True, |
| 92 'inputs_ref': {'a': 1}, | 96 'inputs_ref': {'a': 1}, |
| 93 'io_timeout_secs': 1200, | 97 'io_timeout_secs': 1200, |
| 94 }, | 98 }, |
| 95 'tags': ['master:a', 'buildername:b', 'name:a_tests'], | 99 'tags': ['master:a', 'buildername:b', 'name:a_tests'], |
| 96 'user': 'user', | 100 'user': 'user', |
| 97 }) | 101 }) |
| 98 self.mock(swarming_util, 'GetSwarmingTaskRequest', | 102 self.mock(swarming_util, 'GetSwarmingTaskRequest', |
| 99 MockedGetSwarmingTaskRequest) | 103 MockedGetSwarmingTaskRequest) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 121 'parent_task_id': '', | 125 'parent_task_id': '', |
| 122 'priority': 25, | 126 'priority': 25, |
| 123 'properties': { | 127 'properties': { |
| 124 'command': 'cmd', | 128 'command': 'cmd', |
| 125 'dimensions': [{'key': 'k', 'value': 'v'}], | 129 'dimensions': [{'key': 'k', 'value': 'v'}], |
| 126 'env': [ | 130 'env': [ |
| 127 {'key': 'a', 'value': '1'}, | 131 {'key': 'a', 'value': '1'}, |
| 128 ], | 132 ], |
| 129 'execution_timeout_secs': 3600, | 133 'execution_timeout_secs': 3600, |
| 130 'extra_args': [ | 134 'extra_args': [ |
| 131 '--flag=value', '--gtest_repeat=10', | 135 '--flag=value', |
| 136 '--gtest_filter=a.b:a.c', |
| 137 '--gtest_repeat=10', |
| 132 '--test-launcher-retry-limit=0', | 138 '--test-launcher-retry-limit=0', |
| 133 '--gtest_filter=a.b:a.c'], | 139 '--gtest_also_run_disabled_tests', |
| 140 ], |
| 134 'grace_period_secs': 30, | 141 'grace_period_secs': 30, |
| 135 'idempotent': False, | 142 'idempotent': False, |
| 136 'inputs_ref': {'a': 1}, | 143 'inputs_ref': {'a': 1}, |
| 137 'io_timeout_secs': 1200, | 144 'io_timeout_secs': 1200, |
| 138 }, | 145 }, |
| 139 'tags': ['purpose:deflake', 'ref_master:%s' % master_name, | 146 'tags': ['purpose:deflake', 'ref_master:%s' % master_name, |
| 140 'ref_buildername:%s' % builder_name, | 147 'ref_buildername:%s' % builder_name, |
| 141 'ref_buildnumber:%s' % build_number, | 148 'ref_buildnumber:%s' % build_number, |
| 142 'ref_stepname:%s' % step_name, | 149 'ref_stepname:%s' % step_name, |
| 143 'ref_task_id:1', | 150 'ref_task_id:1', |
| 144 'ref_name:a_tests'], | 151 'ref_name:a_tests'], |
| 145 'user': '', | 152 'user': '', |
| 146 } | 153 } |
| 147 | 154 |
| 148 pipeline = TriggerSwarmingTaskPipeline() | 155 pipeline = TriggerSwarmingTaskPipeline() |
| 149 new_task_id = pipeline.run( | 156 new_task_id = pipeline.run( |
| 150 master_name, builder_name, build_number, step_name, tests) | 157 master_name, builder_name, build_number, step_name, tests) |
| 151 self.assertEqual('new_task_id', new_task_id) | 158 self.assertEqual('new_task_id', new_task_id) |
| 152 self.assertEqual(expected_new_request_json, new_request_json) | 159 self.assertEqual(expected_new_request_json, new_request_json) |
| 153 | 160 |
| 154 swarming_task = WfSwarmingTask.Get( | 161 swarming_task = WfSwarmingTask.Get( |
| 155 master_name, builder_name, build_number, step_name) | 162 master_name, builder_name, build_number, step_name) |
| 156 self.assertIsNotNone(swarming_task) | 163 self.assertIsNotNone(swarming_task) |
| 157 self.assertEqual('new_task_id', swarming_task.task_id) | 164 self.assertEqual('new_task_id', swarming_task.task_id) |
| 158 self.assertEqual(tests, swarming_task.parameters['tests']) | 165 self.assertEqual(tests, swarming_task.parameters['tests']) |
| 159 self.assertEqual( | 166 self.assertEqual( |
| 160 waterfall_config.GetSwarmingSettings()['iterations_to_rerun'], | 167 waterfall_config.GetSwarmingSettings()['iterations_to_rerun'], |
| 161 swarming_task.parameters['iterations_to_rerun']) | 168 swarming_task.parameters['iterations_to_rerun']) |
| OLD | NEW |