Ejemplo n.º 1
0
    def testAnalysesForDuplicateFailuresTrue(self):
        analyses = []
        for i in range(0, 2):
            analysis = WfAnalysis.Create('m', 'b', i)
            analysis.result = {
                'failures': [{
                    'step_name':
                    'a',
                    'first_failure':
                    3,
                    'last_pass':
                    None,
                    'suspected_cls': [{
                        'repo_name': 'chromium',
                        'revision': 'r99_1',
                        'commit_position': 123,
                        'url': None,
                        'score': 5,
                        'hints': {
                            'added x/y/f99_1.cc (and it was in log)': 5,
                        }
                    }],
                }, {
                    'step_name': 'b',
                    'first_failure': 2,
                    'last_pass': None,
                    'suspected_cls': [],
                }]
            }
            analysis.suspected_cls = [{
                'repo_name': 'chromium',
                'revision': 'r99_1',
                'commit_position': 123,
                'url': None
            }]
            analyses.append(analysis)

        self.assertTrue(
            check_duplicate_failures._AnalysesForDuplicateFailures(
                analyses[0], analyses[1]))
  def testAnalysesForDuplicateFailuresTrue(self):
    analyses = []
    for i in range(0, 2):
      analysis = WfAnalysis.Create('m', 'b', i)
      analysis.result = {
          'failures': [
              {
                  'step_name': 'a',
                  'first_failure': 3,
                  'last_pass': None,
                  'suspected_cls': [{
                      'repo_name': 'chromium',
                      'revision': 'r99_1',
                      'commit_position': 123,
                      'url': None,
                      'score': 5,
                      'hints': {
                          'added x/y/f99_1.cc (and it was in log)': 5,
                      }
                  }],
              },
              {
                  'step_name': 'b',
                  'first_failure': 2,
                  'last_pass': None,
                  'suspected_cls': [],
              }
          ]
      }
      analysis.suspected_cls = [{
          'repo_name': 'chromium',
          'revision': 'r99_1',
          'commit_position': 123,
          'url': None
      }]
      analyses.append(analysis)

    self.assertTrue(check_duplicate_failures._AnalysesForDuplicateFailures(
        analyses[0], analyses[1]))
Ejemplo n.º 3
0
    def testAnalysesForDuplicateFailuresFalseDifferentCLs(self):
        analysis_one = WfAnalysis.Create('m', 'b', 0)
        analysis_one.result = {
            'failures': [{
                'step_name':
                'a',
                'first_failure':
                3,
                'last_pass':
                None,
                'suspected_cls': [{
                    'repo_name': 'chromium',
                    'revision': 'r99_1',
                    'commit_position': 123,
                    'url': None,
                    'score': 5,
                    'hints': {
                        'added x/y/f99_1.cc (and it was in log)': 5,
                    }
                }],
            }, {
                'step_name': 'b',
                'first_failure': 2,
                'last_pass': None,
                'suspected_cls': [],
            }]
        }
        analysis_one.suspected_cls = [{
            'repo_name': 'chromium',
            'revision': 'r99_1',
            'commit_position': 123,
            'url': None
        }]

        analysis_two = WfAnalysis.Create('m', 'b', 1)
        analysis_two.result = {
            'failures': [{
                'step_name':
                'a',
                'first_failure':
                3,
                'last_pass':
                None,
                'suspected_cls': [{
                    'repo_name': 'chromium',
                    'revision': 'another revision',
                    'commit_position': 123,
                    'url': None,
                    'score': 5,
                    'hints': {
                        'added x/y/f99_1.cc (and it was in log)': 5,
                    }
                }],
            }, {
                'step_name': 'b',
                'first_failure': 2,
                'last_pass': None,
                'suspected_cls': [],
            }]
        }
        analysis_two.suspected_cls = [{
            'repo_name': 'chromium',
            'revision': 'another revision',
            'commit_position': 123,
            'url': None
        }]

        self.assertFalse(
            check_duplicate_failures._AnalysesForDuplicateFailures(
                analysis_one, analysis_two))
  def testAnalysesForDuplicateFailuresFalseDifferentCLs(self):
    analysis_one = WfAnalysis.Create('m', 'b', 0)
    analysis_one.result = {
        'failures': [
            {
                'step_name': 'a',
                'first_failure': 3,
                'last_pass': None,
                'suspected_cls': [{
                    'repo_name': 'chromium',
                    'revision': 'r99_1',
                    'commit_position': 123,
                    'url': None,
                    'score': 5,
                    'hints': {
                        'added x/y/f99_1.cc (and it was in log)': 5,
                    }
                }],
            },
            {
                'step_name': 'b',
                'first_failure': 2,
                'last_pass': None,
                'suspected_cls': [],
            }
        ]
    }
    analysis_one.suspected_cls = [{
        'repo_name': 'chromium',
        'revision': 'r99_1',
        'commit_position': 123,
        'url': None
    }]

    analysis_two = WfAnalysis.Create('m', 'b', 1)
    analysis_two.result = {
        'failures': [
            {
                'step_name': 'a',
                'first_failure': 3,
                'last_pass': None,
                'suspected_cls': [{
                    'repo_name': 'chromium',
                    'revision': 'another revision',
                    'commit_position': 123,
                    'url': None,
                    'score': 5,
                    'hints': {
                        'added x/y/f99_1.cc (and it was in log)': 5,
                    }
                }],
            },
            {
                'step_name': 'b',
                'first_failure': 2,
                'last_pass': None,
                'suspected_cls': [],
            }
        ]
    }
    analysis_two.suspected_cls = [{
        'repo_name': 'chromium',
        'revision': 'another revision',
        'commit_position': 123,
        'url': None
    }]

    self.assertFalse(check_duplicate_failures._AnalysesForDuplicateFailures(
        analysis_one, analysis_two))