예제 #1
0
    def testGetSwarmingTaskDataAndResultIsolatedError(self, mock_fn, _):
        data = {'outputs_ref': 'ref', 'state': constants.STATE_COMPLETED}
        mock_fn.return_value = (data, None)

        self.assertEqual(
            (data, None, 'error'),
            swarmed_test_util.GetSwarmingTaskDataAndResult(None, None))
예제 #2
0
 def testGetSwarmingTaskDataAndResultFailedState(self, mock_fn):
     data = {'state': 'BOT_DIED', 'outputs_ref': 'outputs_ref'}
     mock_fn.return_value = (data, None)
     error = SwarmingTaskError.FromSerializable({
         'code':
         swarming_task_error.BOT_DIED,
         'message':
         'BOT_DIED'
     })
     self.assertEqual(
         (data, None, error),
         swarmed_test_util.GetSwarmingTaskDataAndResult('task_id', None))
예제 #3
0
    def testGetSwarmingTaskDataAndResultNoOutputRef(self, mock_fn):
        data = {'state': constants.STATE_COMPLETED}
        mock_fn.return_value = (data, None)

        error = SwarmingTaskError.FromSerializable({
            'code':
            swarming_task_error.NO_TASK_OUTPUTS,
            'message':
            'outputs_ref is None'
        })
        self.assertEqual(
            (data, None, error),
            swarmed_test_util.GetSwarmingTaskDataAndResult(None, None))
예제 #4
0
    def testGetSwarmingTaskDataAndResult(self, mock_fn, *_):
        task_id = '2944afa502297110'
        data, result, error = swarmed_test_util.GetSwarmingTaskDataAndResult(
            task_id, None)

        self.assertEqual(
            {
                'outputs_ref': 'ref',
                'state': constants.STATE_COMPLETED
            }, data)
        self.assertEqual('content', result)
        self.assertIsNone(error)
        mock_fn.assert_called_once_with('chromium-swarm.appspot.com', task_id,
                                        None)
예제 #5
0
 def testGetSwarmingTaskDataAndResultRunning(self, mock_fn):
     data = {'state': constants.STATE_RUNNING, 'outputs_ref': 'outputs_ref'}
     mock_fn.return_value = (data, None)
     self.assertEqual(
         (data, None, None),
         swarmed_test_util.GetSwarmingTaskDataAndResult('task_id', None))
예제 #6
0
 def testGetSwarmingTaskDataAndResultNoData(self, mock_fn):
     error = {'code': 1, 'message': 'error'}
     mock_fn.return_value = (None, error)
     self.assertEqual(
         (None, None, SwarmingTaskError.FromSerializable(error)),
         swarmed_test_util.GetSwarmingTaskDataAndResult('task_id', None))