• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mozilla / relman-auto-nag / #5236

27 Sep 2024 03:08PM CUT coverage: 21.646%. Remained the same
#5236

push

coveralls-python

marco-c
Use a much higher overall limit of intermittent bugs to close, keeping a reasonable limit by team to avoid noise

585 of 3508 branches covered (16.68%)

0 of 2 new or added lines in 1 file covered. (0.0%)

1941 of 8967 relevant lines covered (21.65%)

0.22 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/bugbot/rules/close_intermittents.py
1
# This Source Code Form is subject to the terms of the Mozilla Public
2
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
3
# You can obtain one at http://mozilla.org/MPL/2.0/.
4

5
from bugbot.bzcleaner import BzCleaner
×
6
from bugbot.components import ComponentName, fetch_component_teams
×
7

8

9
class Intermittents(BzCleaner):
×
NEW
10
    normal_changes_max: int = 2100
×
11

12
    def __init__(self):
×
13
        super().__init__()
×
14
        self.component_teams = fetch_component_teams()
×
15

16
    def description(self):
×
17
        return "Intermittent test failure bugs unchanged in 21 days"
×
18

19
    def get_max_actions(self):
×
NEW
20
        limit_per_run = 2100
×
21
        limit_per_team = 42
×
22

23
        # Number of teams that have bugs to be autoclosed
24
        number_of_teams = len(self.quota_actions)
×
25

26
        return min([limit_per_run // number_of_teams, limit_per_team])
×
27

28
    def has_product_component(self):
×
29
        return True
×
30

31
    def columns(self):
×
32
        return ["product", "component", "id", "summary"]
×
33

34
    def get_bz_params(self, date):
×
35
        params = {
×
36
            "include_fields": ["_custom", "product", "component"],
37
            "n1": "1",
38
            "f1": "longdescs.count",
39
            "o1": "changedafter",
40
            "v1": "-3w",
41
            "f2": "blocked",
42
            "o2": "isempty",
43
            "f3": "flagtypes.name",
44
            "o3": "notequals",
45
            "v3": "needinfo?",
46
            "f4": "OP",
47
            "n4": "1",
48
            "f5": "bug_status",
49
            "o5": "changedto",
50
            "v5": "REOPENED",
51
            "f6": "bug_status",
52
            "o6": "changedafter",
53
            "v6": "-7d",
54
            "f7": "CP",
55
            "f8": "bug_severity",
56
            "o8": "notequals",
57
            "v8": "S1",
58
            "f9": "keywords",
59
            "o9": "allwords",
60
            "v9": "intermittent-failure",
61
            "f10": "keywords",
62
            "o10": "nowords",
63
            "v10": "test-verify-fail",
64
            "resolution": "---",
65
            "status_whiteboard_type": "notregexp",
66
            "status_whiteboard": "(test disabled|test-disabled|testdisabled)",
67
        }
68

69
        return params
×
70

71
    def handle_bug(self, bug, data):
×
72
        status_flags = {
×
73
            field: "wontfix"
74
            for field, value in bug.items()
75
            if field.startswith("cf_status_") and value in ("affected", "fix-optional")
76
        }
77

78
        autofix = {
×
79
            **status_flags,
80
            "status": "RESOLVED",
81
            "resolution": "INCOMPLETE",
82
            "comment": {
83
                "body": f"https://wiki.mozilla.org/Bug_Triage#Intermittent_Test_Failure_Cleanup\n{self.get_documentation()}"
84
            },
85
        }
86

87
        team_name = self.component_teams[ComponentName.from_bug(bug)]
×
88

89
        self.add_prioritized_action(bug, quota_name=team_name, autofix=autofix)
×
90

91
        return bug
×
92

93

94
if __name__ == "__main__":
×
95
    Intermittents().run()
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc