예제 #1
0
    def test_print_flakiness_stats(self):
        self.mock(cq_stats, "output", self.print_mock)
        args = Args()
        stats_set = cq_stats.default_stats()
        stats_set["begin"] = args.date
        stats_set["end"] = args.date + datetime.timedelta(days=7)

        stats_set["patch_stats"].update(
            {
                (123, 1): {
                    "attempts": 1,
                    "false-rejections": 0,
                    "rejections": 1,
                    "committed": False,
                    "patchset-duration": 3600,
                    "patchset-duration-wallclock": 3600,
                    "failed-jobs-details": {"builder_a": 1},
                }
            }
        )

        self.mock(
            cq_stats,
            "fetch_json",
            lambda _: [
                {"master": "tryserver.chromium.linux", "builder": "chromium_presubmit", "result": 0},
                {"master": "tryserver.chromium.linux", "builder": "chromium_presubmit", "result": -1},
                {"master": "tryserver.chromium.linux", "builder": "chromium_presubmit", "result": 2},
                {
                    "master": "tryserver.chromium.linux",
                    "builder": "linux_chromium_rel_ng",
                    "result": 2,
                    "build_properties": '{"failure_type": "COMPILE_FAILURE"}',
                },
                {
                    "master": "tryserver.chromium.linux",
                    "builder": "linux_chromium_rel_ng",
                    "result": 2,
                    "build_properties": '{"failure_type": "TEST_FAILURE"}',
                },
                {"master": "tryserver.chromium.linux", "builder": "chromium_presubmit", "result": 4},
            ],
        )

        cq_stats.print_flakiness_stats(args, stats_set)

        args.seq = False
        self.mock(
            cq_stats,
            "fetch_json",
            lambda _: [{"master": "tryserver.chromium.linux", "builder": "chromium_presubmit", "result": 2}],
        )
        cq_stats.print_flakiness_stats(args, stats_set)

        return self.expectations
예제 #2
0
  def test_print_flakiness_stats(self):
    self.mock(cq_stats, 'output', self.print_mock)
    args = Args()
    stats_set = cq_stats.default_stats()
    stats_set['begin'] = args.date
    stats_set['end'] = args.date + datetime.timedelta(days=7)

    stats_set['patch_stats'].update({
        (123, 1): {
            'attempts': 1,
            'false-rejections': 0,
            'rejections': 1,
            'committed': False,
            'patchset-duration': 3600,
            'patchset-duration-wallclock': 3600,
            'failed-jobs-details': {
                'builder_a': 1,
            },
        },
    })

    self.mock(cq_stats, 'fetch_json', lambda _: [{
      'master': 'tryserver.chromium.linux',
      'builder': 'chromium_presubmit',
      'result': 0,
      'url': 'https://build.chromium.org/10',
    }, {
      'master': 'tryserver.chromium.linux',
      'builder': 'chromium_presubmit',
      'result': -1,
      'url': 'https://build.chromium.org/20',
    }, {
      'master': 'tryserver.chromium.linux',
      'builder': 'chromium_presubmit',
      'result': 2,
      'url': 'https://build.chromium.org/30',
    }, {
      'master': 'tryserver.chromium.linux',
      'builder': 'linux_chromium_rel_ng',
      'result': 2,
      'build_properties': '{"failure_type": "COMPILE_FAILURE"}',
      'url': 'https://build.chromium.org/40',
    }, {
      'master': 'tryserver.chromium.linux',
      'builder': 'linux_chromium_rel_ng',
      'result': 2,
      'build_properties': '{"failure_type": "TEST_FAILURE"}',
      'url': 'https://build.chromium.org/50',
    }, {
      'master': 'tryserver.chromium.linux',
      'builder': 'linux_chromium_rel_ng',
      'result': 2,
      'build_properties': '{"failure_type": "INVALID_TEST_RESULTS"}',
      'url': 'https://build.chromium.org/50',
    }, {
      'master': 'tryserver.chromium.linux',
      'builder': 'linux_chromium_rel_ng',
      'result': 2,
      'build_properties': '{"failure_type": "PATCH_FAILURE"}',
      'url': 'https://build.chromium.org/50',
    }, {
      'master': 'tryserver.chromium.linux',
      'builder': 'chromium_presubmit',
      'result': 4,
      'url': 'https://build.chromium.org/60',
    }])

    cq_stats.print_flakiness_stats(args, stats_set)

    args.seq = False
    args.list_uncategorized_flakes = True
    self.mock(cq_stats, 'fetch_json', lambda _: [{
      'master': 'tryserver.chromium.linux',
      'builder': 'chromium_presubmit',
      'result': 0,
      'url': 'https://build.chromium.org/70',
    }, {
      'master': 'tryserver.chromium.linux',
      'builder': 'chromium_presubmit',
      'result': 2,
      'url': 'https://build.chromium.org/75',
    }, {
      'master': 'tryserver.chromium.linux',
      'builder': 'linux_chromium_rel_ng',
      'result': 2,
      'build_properties': '{"failure_type": "COMPILE_FAILURE"}',
      'url': 'https://build.chromium.org/80',
    }])
    cq_stats.print_flakiness_stats(args, stats_set)

    return self.expectations
예제 #3
0
    def test_print_flakiness_stats(self):
        self.mock(cq_stats, 'output', self.print_mock)
        args = Args()
        stats_set = cq_stats.default_stats()
        stats_set['begin'] = args.date
        stats_set['end'] = args.date + datetime.timedelta(days=7)

        stats_set['patch_stats'].update({
            (123, 1): {
                'attempts': 1,
                'false-rejections': 0,
                'rejections': 1,
                'committed': False,
                'patchset-duration': 3600,
                'patchset-duration-wallclock': 3600,
                'failed-jobs-details': {
                    'builder_a': 1,
                },
            },
        })

        self.mock(
            cq_stats, 'fetch_json', lambda _:
            [{
                'master': 'tryserver.chromium.linux',
                'builder': 'chromium_presubmit',
                'result': 0,
            }, {
                'master': 'tryserver.chromium.linux',
                'builder': 'chromium_presubmit',
                'result': -1,
            }, {
                'master': 'tryserver.chromium.linux',
                'builder': 'chromium_presubmit',
                'result': 2,
            }, {
                'master': 'tryserver.chromium.linux',
                'builder': 'linux_chromium_rel_ng',
                'result': 2,
                'build_properties': '{"failure_type": "COMPILE_FAILURE"}',
            }, {
                'master': 'tryserver.chromium.linux',
                'builder': 'linux_chromium_rel_ng',
                'result': 2,
                'build_properties': '{"failure_type": "TEST_FAILURE"}',
            }, {
                'master': 'tryserver.chromium.linux',
                'builder': 'chromium_presubmit',
                'result': 4,
            }])

        cq_stats.print_flakiness_stats(args, stats_set)

        args.seq = False
        self.mock(
            cq_stats, 'fetch_json', lambda _: [{
                'master': 'tryserver.chromium.linux',
                'builder': 'chromium_presubmit',
                'result': 2,
            }])
        cq_stats.print_flakiness_stats(args, stats_set)

        return self.expectations