Пример #1
0
 def testMissingDependency(self):
     job = job_module.Job.New((), ())
     task_module.PopulateTaskGraph(
         job,
         task_module.TaskGraph(vertices=[
             task_module.TaskVertex(id='run_test_bbbbbbb_0',
                                    vertex_type='run_test',
                                    payload={
                                        'swarming_server': 'some_server',
                                        'dimensions': DIMENSIONS,
                                        'extra_args': [],
                                    }),
         ],
                               edges=[]))
     self.assertEqual(
         {
             'run_test_bbbbbbb_0': {
                 'errors': [{
                     'cause': 'DependencyError',
                     'message': mock.ANY
                 }]
             }
         },
         task_module.Evaluate(
             job,
             event_module.Event(type='validate',
                                target_task=None,
                                payload={}), run_test.Validator()))
Пример #2
0
    def testMissingDependencyInputs(self):
        job = job_module.Job.New((), ())
        task_module.PopulateTaskGraph(
            job,
            task_module.TaskGraph(
                vertices=[
                    task_module.TaskVertex(id='find_isolate_chromium@aaaaaaa',
                                           vertex_type='find_isolate',
                                           payload={
                                               'builder': 'Some Builder',
                                               'target':
                                               'telemetry_perf_tests',
                                               'bucket': 'luci.bucket',
                                               'change': {
                                                   'commits': [{
                                                       'repository':
                                                       'chromium',
                                                       'git_hash':
                                                       'aaaaaaa',
                                                   }]
                                               }
                                           }),
                    task_module.TaskVertex(id='run_test_chromium@aaaaaaa_0',
                                           vertex_type='run_test',
                                           payload={
                                               'swarming_server':
                                               'some_server',
                                               'dimensions': DIMENSIONS,
                                               'extra_args': [],
                                           }),
                ],
                edges=[
                    task_module.Dependency(from_='run_test_chromium@aaaaaaa_0',
                                           to='find_isolate_chromium@aaaaaaa')
                ],
            ))

        # This time we're fine, there should be no errors.
        self.assertEqual({},
                         task_module.Evaluate(
                             job,
                             event_module.Event(type='validate',
                                                target_task=None,
                                                payload={}),
                             run_test.Validator()))

        # Send an initiate message then catch that we've not provided the required
        # payload in the task when it's ongoing.
        self.assertEqual(
            {
                'find_isolate_chromium@aaaaaaa': mock.ANY,
                'run_test_chromium@aaaaaaa_0': {
                    'errors': [{
                        'cause': 'MissingDependencyInputs',
                        'message': mock.ANY
                    }]
                }
            },
            task_module.Evaluate(
                job,
                event_module.Event(type='initiate',
                                   target_task=None,
                                   payload={}),
                evaluators.FilteringEvaluator(
                    predicate=evaluators.TaskTypeEq('find_isolate'),
                    delegate=evaluators.SequenceEvaluator(evaluators=(
                        functools.partial(
                            bisection_test_util.FakeNotFoundIsolate, job),
                        evaluators.TaskPayloadLiftingEvaluator(),
                    )),
                    alternative=run_test.Validator()),
            ))