Beispiel #1
0
    def testGetSwarmingTaskIdForTryJobNoOutputJson(self, _):
        revision = 'r0'
        step_name = 'gl_tests'
        test_name = 'Test.One'
        report = {
            'result': {
                'r0': {
                    'gl_tests': {
                        'status': 'passed',
                        'valid': True,
                        'pass_fail_counts': {
                            'Test.One': {
                                'pass_count': 100,
                                'fail_count': 0
                            }
                        },
                        'step_metadata': {
                            'swarm_task_ids': ['task1', 'task2']
                        }
                    }
                }
            }
        }

        self.assertIsNone(
            flake_try_job.GetSwarmingTaskIdForTryJob(report, revision,
                                                     step_name, test_name))
Beispiel #2
0
    def testGetSwarmingTaskIdForTryJobNotFoundTaskWithResult(
            self, mock_fn, *_):
        output_json = {'per_iteration_data': [{}, {}]}
        mock_fn.return_result = output_json

        revision = 'r0'
        step_name = 'gl_tests'
        test_name = 'Test.One'
        report = {
            'result': {
                'r0': {
                    'gl_tests': {
                        'status': 'passed',
                        'valid': True,
                        'pass_fail_counts': {
                            'Test.One': {
                                'pass_count': 100,
                                'fail_count': 0
                            }
                        },
                        'step_metadata': {
                            'swarm_task_ids': ['task1', 'task2']
                        }
                    }
                }
            }
        }

        self.assertIsNone(
            flake_try_job.GetSwarmingTaskIdForTryJob(report, revision,
                                                     step_name, test_name))
Beispiel #3
0
    def testGetSwarmingTaskIdForTryJobTestNotExist(self):
        revision = 'r0'
        step_name = 'gl_tests'
        test_name = 'Test.One'
        report = {
            'result': {
                'r0': {
                    'gl_tests': {
                        'status': 'passed',
                        'valid': True,
                        'pass_fail_counts': {},
                        'step_metadata': {
                            'swarm_task_ids': ['task1', 'task2']
                        }
                    }
                }
            }
        }

        self.assertEquals(
            flake_try_job.GetSwarmingTaskIdForTryJob(report, revision,
                                                     step_name, test_name),
            'task1')
Beispiel #4
0
    def testGetSwarmingTaskIdForTryJob(self, mock_fn, *_):
        output_json_1 = {'per_iteration_data': [{}, {}]}
        output_json_2 = {
            'per_iteration_data': [{
                'Test.One': 'log for Test.One'
            }]
        }
        mock_fn.side_effect = [output_json_1, output_json_2]

        revision = 'r0'
        step_name = 'gl_tests'
        test_name = 'Test.One'
        report = {
            'result': {
                'r0': {
                    'gl_tests': {
                        'status': 'passed',
                        'valid': True,
                        'pass_fail_counts': {
                            'Test.One': {
                                'pass_count': 100,
                                'fail_count': 0
                            }
                        },
                        'step_metadata': {
                            'swarm_task_ids': ['task1', 'task2']
                        }
                    }
                }
            }
        }

        task_id = flake_try_job.GetSwarmingTaskIdForTryJob(
            report, revision, step_name, test_name)

        self.assertEquals('task2', task_id)
Beispiel #5
0
 def testGetSwarmingTaskIdForTryJobNoReport(self):
     self.assertIsNone(
         flake_try_job.GetSwarmingTaskIdForTryJob(None, None, None, None))