def testGetAllTryJobResultsForTestNonSwarming(self):
        tasks_info = {
            'step1': {
                'swarming_tasks': {
                    'm/b/119': {
                        'task_info': {
                            'status': result_status.NON_SWARMING_NO_RERUN
                        },
                        'all_tests': ['test1']
                    },
                }
            }
        }
        result = handlers_util._GetAllTryJobResultsForTest(
            {'step1': 'm/b/119'}, tasks_info)

        expected_result = {
            'step1': {
                'try_jobs': [{
                    'try_job_key':
                    'm/b/119',
                    'status':
                    result_status.NO_TRY_JOB_REASON_MAP.get(
                        result_status.NON_SWARMING_NO_RERUN),
                    'tests': ['test1']
                }]
            }
        }
        self.assertEqual(expected_result, result)
    def testGetAllTryJobResultsForTestNonSwarmingForcedTryJob(self):
        tasks_info = {
            'step1': {
                'swarming_tasks': {
                    'm/b/119': {
                        'task_info': {
                            'status': result_status.NON_SWARMING_NO_RERUN
                        },
                        'all_tests': ['test1']
                    },
                }
            }
        }
        result = handlers_util._GetAllTryJobResultsForTest(
            {'step1': 'm/b/119'}, tasks_info, True)

        expected_result = {
            'step1': {
                'try_jobs': [{
                    'try_job_key': 'm/b/119',
                    'ref_name': 'step1',
                    'can_force': True,
                    'status': result_status.NON_SWARMING_NO_RERUN,
                    'tests': ['test1']
                }]
            }
        }

        self.assertEqual(expected_result, result)
Exemple #3
0
  def testGetAllTryJobResultsForTestNonSwarming(self):
    tasks_info = {
        'step1': {
            'swarming_tasks': {
                'm/b/119': {
                    'task_info': {
                        'status': result_status.NON_SWARMING_NO_RERUN
                    },
                    'all_tests': ['test1']
                },
            }
        }
    }
    result = handlers_util._GetAllTryJobResultsForTest(
        {'step1': 'm/b/119'}, tasks_info)

    expected_result = {
        'step1': {
            'try_jobs': [
                {
                    'try_job_key': 'm/b/119',
                    'status': result_status.NO_TRY_JOB_REASON_MAP.get(
                        result_status.NON_SWARMING_NO_RERUN),
                    'tests': ['test1']
                }
            ]
        }
    }
    self.assertEqual(expected_result, result)
    def testGetAllTryJobResultsForTestSwarmingTaskNotComplete(self):
        failure_result_map = {
            'step1': {
                'test1': 'm/b/118',
                'test3': 'm/b/119'
            }
        }

        tasks_info = {
            'step1': {
                'swarming_tasks': {
                    'm/b/118': {
                        'task_info': {
                            'status': analysis_status.PENDING
                        },
                        'all_tests': ['test1']
                    },
                    'm/b/119': {
                        'task_info': {
                            'status': analysis_status.RUNNING,
                            'task_id': 'task3',
                            'task_url': 'task3_url'
                        },
                        'all_tests': ['test3']
                    }
                }
            }
        }

        result = handlers_util._GetAllTryJobResultsForTest(
            failure_result_map, tasks_info)

        expected_result = {
            'step1': {
                'try_jobs': [{
                    'try_job_key':
                    'm/b/118',
                    'status':
                    result_status.NO_TRY_JOB_REASON_MAP[
                        analysis_status.PENDING],
                    'tests': ['test1']
                }, {
                    'try_job_key':
                    'm/b/119',
                    'status':
                    result_status.NO_TRY_JOB_REASON_MAP[
                        analysis_status.RUNNING],
                    'task_id':
                    'task3',
                    'task_url':
                    'task3_url',
                    'tests': ['test3']
                }]
            }
        }

        self.assertEqual(expected_result, result)
    def testGetAllTryJobResultsForTestNoSwarmingTaskInfo(self):
        failure_result_map = {'step1': {'test3': 'm/b/119'}}

        tasks_info = {}

        result = handlers_util._GetAllTryJobResultsForTest(
            failure_result_map, tasks_info)

        self.assertEqual({}, result)
Exemple #6
0
  def testGetAllTryJobResultsForTestSwarmingTaskNotComplete(self):
    failure_result_map = {
        'step1': {
            'test1': 'm/b/118',
            'test3': 'm/b/119'
        }
    }

    tasks_info = {
        'step1': {
            'swarming_tasks': {
                'm/b/118': {
                    'task_info': {
                        'status': analysis_status.PENDING
                    },
                    'all_tests': ['test1']
                },
                'm/b/119': {
                    'task_info': {
                        'status': analysis_status.RUNNING,
                        'task_id': 'task3',
                        'task_url': 'task3_url'
                    },
                    'all_tests': ['test3']
                }
            }
        }
    }

    result = handlers_util._GetAllTryJobResultsForTest(
        failure_result_map, tasks_info)

    expected_result = {
        'step1': {
            'try_jobs': [
                {
                    'try_job_key': 'm/b/118',
                    'status': result_status.NO_TRY_JOB_REASON_MAP[
                        analysis_status.PENDING],
                    'tests': ['test1']
                },
                {
                    'try_job_key': 'm/b/119',
                    'status': result_status.NO_TRY_JOB_REASON_MAP[
                        analysis_status.RUNNING],
                    'task_id': 'task3',
                    'task_url': 'task3_url',
                    'tests': ['test3']
                }
            ]
        }
    }
    self.assertEqual(expected_result, result)
Exemple #7
0
  def testGetAllTryJobResultsForTestNoSwarmingTaskInfo(self):
    failure_result_map = {
        'step1': {
            'test3': 'm/b/119'
        }
    }

    tasks_info = {}

    result = handlers_util._GetAllTryJobResultsForTest(
        failure_result_map, tasks_info)

    self.assertEqual({}, result)
    def testGetAllTryJobResultsForTest(self):
        failure_result_map = {
            'step1 on platform': {
                'test1': 'm/b/118',
                'test2': 'm/b/119',
                'test3': 'm/b/119',
                'test4': 'm/b/119'
            }
        }

        tasks_info = {
            'step1 on platform': {
                'swarming_tasks': {
                    'm/b/119': {
                        'task_info': {
                            'status': analysis_status.COMPLETED,
                            'task_id': 'task1',
                            'task_url': 'url/task1'
                        },
                        'all_tests': ['test2', 'test3', 'test4'],
                        'reliable_tests': ['test2', 'test3'],
                        'flaky_tests': ['test4'],
                        'ref_name': 'step1'
                    },
                    'm/b/118': {
                        'task_info': {
                            'status': result_status.NO_SWARMING_TASK_FOUND
                        },
                        'all_tests': ['test1']
                    }
                }
            }
        }

        try_job = WfTryJob.Create('m', 'b', 119)
        try_job.status = analysis_status.COMPLETED
        try_job.test_results = [{
            'report': {
                'result': {
                    'rev1': {
                        'step1': {
                            'status': 'passed',
                            'valid': True
                        }
                    },
                    'rev2': {
                        'step1': {
                            'status': 'failed',
                            'valid': True,
                            'failures': ['test2']
                        }
                    }
                }
            },
            'url': ('http://build.chromium.org/p/tryserver.chromium.'
                    'linux/builders/linux_chromium_variable/builds/121'),
            'try_job_id':
            'try_job_id',
            'culprit': {
                'step1': {
                    'tests': {
                        'test2': {
                            'revision': 'rev2',
                            'commit_position': '2',
                            'review_url': 'url_2'
                        }
                    }
                }
            }
        }]
        try_job.put()

        result = handlers_util._GetAllTryJobResultsForTest(
            failure_result_map, tasks_info)

        expected_result = {
            'step1 on platform': {
                'try_jobs': [{
                    'try_job_key':
                    'm/b/118',
                    'status':
                    result_status.NO_TRY_JOB_REASON_MAP.get(
                        result_status.NO_SWARMING_TASK_FOUND),
                    'tests': ['test1']
                }, {
                    'ref_name':
                    'step1',
                    'try_job_key':
                    'm/b/119',
                    'task_id':
                    'task1',
                    'task_url':
                    'url/task1',
                    'status':
                    analysis_status.COMPLETED,
                    'try_job_url':
                    ('http://build.chromium.org/p/tryserver.chromium.'
                     'linux/builders/linux_chromium_variable/builds/121'),
                    'try_job_build_number':
                    121,
                    'tests': ['test3'],
                    'culprit': {}
                }, {
                    'ref_name':
                    'step1',
                    'try_job_key':
                    'm/b/119',
                    'task_id':
                    'task1',
                    'task_url':
                    'url/task1',
                    'status':
                    analysis_status.COMPLETED,
                    'try_job_url':
                    ('http://build.chromium.org/p/tryserver.chromium.'
                     'linux/builders/linux_chromium_variable/builds/121'),
                    'try_job_build_number':
                    121,
                    'culprit': {
                        'revision': 'rev2',
                        'commit_position': '2',
                        'review_url': 'url_2'
                    },
                    'tests': ['test2']
                }, {
                    'ref_name': 'step1',
                    'try_job_key': 'm/b/119',
                    'status': result_status.FLAKY,
                    'task_id': 'task1',
                    'task_url': 'url/task1',
                    'tests': ['test4']
                }]
            }
        }
        self.assertEqual(set(expected_result), set(result))
    def testGetAllTryJobResultsForTestHasCulprit(self):
        failure_result_map = {'step1 on platform': {'test3': 'm/b/119'}}

        tasks_info = {
            'step1 on platform': {
                'swarming_tasks': {
                    'm/b/119': {
                        'task_info': {
                            'status':
                            analysis_status.COMPLETED,
                            'task_id':
                            'task1',
                            'task_url':
                            ('https://chromium-swarm.appspot.com/user'
                             '/task/task1')
                        },
                        'all_tests': ['test3'],
                        'reliable_tests': ['test3'],
                        'flaky_tests': [],
                        'ref_name': 'step1'
                    }
                }
            }
        }

        try_job = WfTryJob.Create('m', 'b', 119)
        try_job.status = analysis_status.COMPLETED
        try_job.test_results = [{
            'report': {
                'result': {
                    'rev1': {
                        'step1': {
                            'status': 'passed',
                            'valid': True
                        }
                    },
                    'rev2': {
                        'step1': {
                            'status': 'failed',
                            'valid': True,
                            'failures': ['test3']
                        }
                    }
                }
            },
            'url': ('http://build.chromium.org/p/tryserver.chromium.'
                    'linux/builders/linux_chromium_variable/builds/121'),
            'try_job_id':
            'try_job_id',
            'culprit': {
                'step1': {
                    'tests': {
                        'test3': {
                            'revision': 'rev2',
                            'commit_position': '2',
                            'review_url': 'url_2'
                        }
                    }
                }
            }
        }]
        try_job.put()

        result = handlers_util._GetAllTryJobResultsForTest(
            failure_result_map, tasks_info)

        expected_result = {
            'step1 on platform': {
                'try_jobs': [{
                    'ref_name':
                    'step1',
                    'try_job_key':
                    'm/b/119',
                    'status':
                    analysis_status.COMPLETED,
                    'try_job_url':
                    ('http://build.chromium.org/p/tryserver.chromium.'
                     'linux/builders/linux_chromium_variable/builds/121'),
                    'try_job_build_number':
                    121,
                    'culprit': {
                        'revision': 'rev2',
                        'commit_position': '2',
                        'review_url': 'url_2'
                    },
                    'task_id':
                    'task1',
                    'task_url': ('https://chromium-swarm.appspot.com/user'
                                 '/task/task1'),
                    'tests': ['test3']
                }]
            }
        }
        self.assertEqual(expected_result, result)
Exemple #10
0
  def testGetAllTryJobResultsForTest(self):
    failure_result_map = {
        'step1 on platform': {
            'test1': 'm/b/118',
            'test2': 'm/b/119',
            'test3': 'm/b/119',
            'test4': 'm/b/119'
        }
    }

    tasks_info = {
        'step1 on platform': {
            'swarming_tasks': {
                'm/b/119': {
                    'task_info': {
                        'status': analysis_status.COMPLETED,
                        'task_id': 'task1',
                        'task_url': 'url/task1'
                    },
                    'all_tests': ['test2', 'test3', 'test4'],
                    'reliable_tests': ['test2', 'test3'],
                    'flaky_tests': ['test4'],
                    'ref_name': 'step1'
                },
                'm/b/118': {
                    'task_info': {
                        'status': result_status.NO_SWARMING_TASK_FOUND
                    },
                    'all_tests': ['test1']
                }
            }
        }
    }

    try_job = WfTryJob.Create('m', 'b', 119)
    try_job.status = analysis_status.COMPLETED
    try_job.test_results = [
        {
            'report': {
                'result': {
                    'rev1': {
                        'step1': {
                            'status': 'passed',
                            'valid': True
                        }
                    },
                    'rev2': {
                        'step1': {
                            'status': 'failed',
                            'valid': True,
                            'failures': ['test2']
                        }
                    }
                }
            },
            'url': ('http://build.chromium.org/p/tryserver.chromium.'
                    'linux/builders/linux_chromium_variable/builds/121'),
            'try_job_id': 'try_job_id',
            'culprit': {
                'step1': {
                    'tests': {
                        'test2': {
                            'revision': 'rev2',
                            'commit_position': '2',
                            'review_url': 'url_2'
                        }
                    }
                }
            }
        }
    ]
    try_job.put()

    result = handlers_util._GetAllTryJobResultsForTest(
        failure_result_map, tasks_info)

    expected_result = {
        'step1 on platform': {
            'try_jobs': [
                {
                    'try_job_key': 'm/b/118',
                    'status': result_status.NO_TRY_JOB_REASON_MAP.get(
                        result_status.NO_SWARMING_TASK_FOUND),
                    'tests': ['test1']
                },
                {
                    'ref_name': 'step1',
                    'try_job_key': 'm/b/119',
                    'task_id': 'task1',
                    'task_url': 'url/task1',
                    'status': analysis_status.COMPLETED,
                    'try_job_url': (
                        'http://build.chromium.org/p/tryserver.chromium.'
                        'linux/builders/linux_chromium_variable/builds/121'),
                    'try_job_build_number': 121,
                    'tests': ['test3'],
                    'culprit': {}
                },
                {
                    'ref_name': 'step1',
                    'try_job_key': 'm/b/119',
                    'task_id': 'task1',
                    'task_url': 'url/task1',
                    'status': analysis_status.COMPLETED,
                    'try_job_url': (
                        'http://build.chromium.org/p/tryserver.chromium.'
                        'linux/builders/linux_chromium_variable/builds/121'),
                    'try_job_build_number': 121,
                    'culprit': {
                        'revision': 'rev2',
                        'commit_position': '2',
                        'review_url': 'url_2'
                    },
                    'tests': ['test2']
                },
                {
                    'ref_name': 'step1',
                    'try_job_key': 'm/b/119',
                    'status': result_status.FLAKY,
                    'task_id': 'task1',
                    'task_url': 'url/task1',
                    'tests': ['test4']
                }
            ]
        }
    }
    self.assertEqual(set(expected_result), set(result))
Exemple #11
0
  def testGetAllTryJobResultsForTestHasCulprit(self):
    failure_result_map = {
        'step1 on platform': {
            'test3': 'm/b/119'
        }
    }

    tasks_info = {
        'step1 on platform': {
            'swarming_tasks': {
                'm/b/119': {
                    'task_info': {
                        'status': analysis_status.COMPLETED,
                        'task_id': 'task1',
                        'task_url': ('https://chromium-swarm.appspot.com/user'
                                     '/task/task1')
                    },
                    'all_tests': ['test3'],
                    'reliable_tests': ['test3'],
                    'flaky_tests': [],
                    'ref_name': 'step1'
                }
            }
        }
    }

    try_job = WfTryJob.Create('m', 'b', 119)
    try_job.status = analysis_status.COMPLETED
    try_job.test_results = [
        {
            'report': {
                'result': {
                    'rev1': {
                        'step1': {
                            'status': 'passed',
                            'valid': True
                        }
                    },
                    'rev2': {
                        'step1': {
                            'status': 'failed',
                            'valid': True,
                            'failures': ['test3']
                        }
                    }
                }
            },
            'url': ('http://build.chromium.org/p/tryserver.chromium.'
                    'linux/builders/linux_chromium_variable/builds/121'),
            'try_job_id': 'try_job_id',
            'culprit': {
                'step1': {
                    'tests': {
                        'test3': {
                            'revision': 'rev2',
                            'commit_position': '2',
                            'review_url': 'url_2'
                        }
                    }
                }
            }
        }
    ]
    try_job.put()

    result = handlers_util._GetAllTryJobResultsForTest(
        failure_result_map, tasks_info)

    expected_result = {
        'step1 on platform': {
            'try_jobs': [
                {
                    'ref_name': 'step1',
                    'try_job_key': 'm/b/119',
                    'status': analysis_status.COMPLETED,
                    'try_job_url': (
                        'http://build.chromium.org/p/tryserver.chromium.'
                        'linux/builders/linux_chromium_variable/builds/121'),
                    'try_job_build_number': 121,
                    'culprit': {
                        'revision': 'rev2',
                        'commit_position': '2',
                        'review_url': 'url_2'
                    },
                    'task_id': 'task1',
                    'task_url': ('https://chromium-swarm.appspot.com/user'
                                 '/task/task1'),
                    'tests': ['test3']
                }
            ]
        }
    }
    self.assertEqual(expected_result, result)