Exemplo n.º 1
0
    def testGetTryJobResultForCompileNonBuildbot(self):
        try_job = WfTryJob.Create(self.master_name, self.builder_name,
                                  self.build_number)
        try_job.status = analysis_status.RUNNING
        try_job.compile_results = [{
            'result': None,
            'url': 'https://luci-milo.appspot.com/swarming/task/3639e',
            'try_job_id': '12341234'
        }]
        try_job.put()

        result = handlers_util._GetTryJobResultForCompile(
            {'compile': 'm/b/121'})

        expected_result = {
            'compile': {
                'try_jobs': [{
                    'try_job_key':
                    'm/b/121',
                    'status':
                    analysis_status.RUNNING,
                    'try_job_build_number':
                    '12341234',
                    'try_job_url':
                    'https://luci-milo.appspot.com/swarming/task/3639e',
                }]
            }
        }
        self.assertEqual(expected_result, result)
Exemplo n.º 2
0
  def testGetTryJobResultForCompileOnlyReturnStatusIfError(self):
    try_job = WfTryJob.Create(
        self.master_name, self.builder_name, self.build_number)
    try_job.status = analysis_status.ERROR
    try_job.compile_results = [
        {
            'try_job_id': '1'
        }
    ]
    try_job.put()

    result = handlers_util._GetTryJobResultForCompile({'compile': 'm/b/121'})

    expected_result = {
        'compile': {
            'try_jobs': [
                {
                    'try_job_key': 'm/b/121',
                    'status': analysis_status.ERROR
                }
            ]
        }
    }

    self.assertEqual(expected_result, result)
Exemplo n.º 3
0
    def testGetTryJobResultForCompileOnlyReturnUrlIfStarts(self):
        try_job = WfTryJob.Create(self.master_name, self.builder_name,
                                  self.build_number)
        try_job.status = analysis_status.RUNNING
        try_job.compile_results = [{
            'result':
            None,
            'url': ('http://build.chromium.org/p/tryserver.chromium.linux/'
                    'builders/linux_chromium_variable/builds/121')
        }]
        try_job.put()

        result = handlers_util._GetTryJobResultForCompile(
            {'compile': 'm/b/121'})

        expected_result = {
            'compile': {
                'try_jobs': [{
                    'try_job_key':
                    'm/b/121',
                    'status':
                    analysis_status.RUNNING,
                    'try_job_build_number':
                    121,
                    'try_job_url':
                    ('http://build.chromium.org/p/tryserver.chromium.'
                     'linux/builders/linux_chromium_variable/builds/121')
                }]
            }
        }
        self.assertEqual(expected_result, result)
Exemplo n.º 4
0
  def testGetTryJobResultForCompileOnlyReturnUrlIfStarts(self):
    try_job = WfTryJob.Create(
        self.master_name, self.builder_name, self.build_number)
    try_job.status = analysis_status.RUNNING
    try_job.compile_results = [
        {
            'result': None,
            'url': ('http://build.chromium.org/p/tryserver.chromium.linux/'
                    'builders/linux_chromium_variable/builds/121')
        }
    ]
    try_job.put()

    result = handlers_util._GetTryJobResultForCompile({'compile': 'm/b/121'})

    expected_result = {
        'compile': {
            'try_jobs': [
                {
                    'try_job_key': 'm/b/121',
                    'status': analysis_status.RUNNING,
                    'try_job_build_number': 121,
                    'try_job_url': (
                        'http://build.chromium.org/p/tryserver.chromium.'
                        'linux/builders/linux_chromium_variable/builds/121')
                }
            ]
        }
    }
    self.assertEqual(expected_result, result)
Exemplo n.º 5
0
    def testGetTryJobResultForCompileOnlyReturnStatusNoResult(self):
        WfTryJob.Create(self.master_name, self.builder_name,
                        self.build_number).put()

        result = handlers_util._GetTryJobResultForCompile(
            {'compile': 'm/b/121'})

        expected_result = {
            'compile': {
                'try_jobs': [{
                    'try_job_key': 'm/b/121',
                    'status': analysis_status.PENDING
                }]
            }
        }

        self.assertEqual(expected_result, result)
Exemplo n.º 6
0
  def testGetTryJobResultForCompileOnlyReturnStatusNoResult(self):
    WfTryJob.Create(
        self.master_name, self.builder_name, self.build_number).put()

    result = handlers_util._GetTryJobResultForCompile({'compile': 'm/b/121'})

    expected_result = {
        'compile': {
            'try_jobs': [
                {
                    'try_job_key': 'm/b/121',
                    'status': analysis_status.PENDING
                }
            ]
        }
    }

    self.assertEqual(expected_result, result)
Exemplo n.º 7
0
    def testGetTryJobResultForCompileOnlyReturnStatusIfError(self):
        try_job = WfTryJob.Create(self.master_name, self.builder_name,
                                  self.build_number)
        try_job.status = analysis_status.ERROR
        try_job.compile_results = [{'try_job_id': '1'}]
        try_job.put()

        result = handlers_util._GetTryJobResultForCompile(
            {'compile': 'm/b/121'})

        expected_result = {
            'compile': {
                'try_jobs': [{
                    'try_job_key': 'm/b/121',
                    'status': analysis_status.ERROR
                }]
            }
        }

        self.assertEqual(expected_result, result)
Exemplo n.º 8
0
    def testGetTryJobResultForCompileReturnNoneIfNoTryJob(self):
        result = handlers_util._GetTryJobResultForCompile(
            {'compile': 'm/b/121'})

        self.assertEqual({}, result)
Exemplo n.º 9
0
  def testGetTryJobResultForCompileReturnNoneIfNoTryJob(self):
    result = handlers_util._GetTryJobResultForCompile({'compile': 'm/b/121'})

    self.assertEqual({}, result)