def __init__(self): super(ToTriage, self).__init__() self.escalation = Escalation(self.people, data=self.get_config('escalation')) self.round_robin = RoundRobin( people=self.people, teams=self.get_config('teams', []) ) self.components = self.round_robin.get_components()
def __init__(self, typ): super(NoPriority, self).__init__() assert typ in {'first', 'second'} self.typ = typ self.lookup_first = utils.get_config(self.name(), 'first-step', 2) self.lookup_second = utils.get_config(self.name(), 'second-step', 4) self.escalation = Escalation( self.people, data=utils.get_config(self.name(), 'escalation-{}'.format(typ)), blacklist=utils.get_config('workflow', 'supervisor_blacklist', []), ) self.round_robin = RoundRobin(people=self.people)
def __init__(self): super(ToTriage, self).__init__() self.escalation = Escalation(self.people, data=self.get_config("escalation")) self.round_robin = RoundRobin.get_instance( teams=self.get_config("teams", [])) self.components = self.round_robin.get_components() for person in self.get_config("persons", []): self.components += utils.get_triage_owners()[person]
def test_get_who_to_nag(self): rr = RoundRobin( rr={'team': TestRoundRobin.config}, people=TestRoundRobin.people ) empty = {'team': {'nobody': True, 'persons': []}} assert rr.get_who_to_nag('2019-02-25') == {} assert rr.get_who_to_nag('2019-03-01') == {'*****@*****.**': empty} assert rr.get_who_to_nag('2019-03-05') == {'*****@*****.**': empty} assert rr.get_who_to_nag('2019-03-07') == {'*****@*****.**': empty} assert rr.get_who_to_nag('2019-03-10') == {'*****@*****.**': empty} with patch.object(People, 'get_moz_mail', return_value=None): rr = RoundRobin( rr={'team': TestRoundRobin.config}, people=TestRoundRobin.people ) self.assertRaises(BadFallback, rr.get_who_to_nag, '2019-03-01')
def __init__(self): super(P1NoAssignee, self).__init__() self.escalation = Escalation( self.people, data=utils.get_config(self.name(), "escalation"), skiplist=utils.get_config("workflow", "supervisor_skiplist", []), ) self.round_robin = RoundRobin.get_instance() self.components_skiplist = utils.get_config("workflow", "components_skiplist")
def __init__(self): super(ToTriage, self).__init__() self.escalation = Escalation(self.people, data=self.get_config("escalation")) try: self.round_robin = RoundRobin.get_instance( teams=self.get_config("teams", [])) except (BadFallback, InvalidCalendar) as err: logger.error(err) self.components = self.round_robin.get_components() for person in self.get_config("persons", []): self.components += utils.get_triage_owners()[person]
def __init__(self, typ): super(NoSeverity, self).__init__() assert typ in {"first", "second"} self.typ = typ self.lookup_first = utils.get_config(self.name(), "first-step", 2) self.lookup_second = utils.get_config(self.name(), "second-step", 4) self.escalation = Escalation( self.people, data=utils.get_config(self.name(), "escalation-{}".format(typ)), skiplist=utils.get_config("workflow", "supervisor_skiplist", []), ) self.round_robin = RoundRobin.get_instance() self.components_skiplist = utils.get_config("workflow", "components_skiplist")
def test_get_who_to_nag(self): rr = RoundRobin(rr={'team': TestRoundRobin.config}, people=TestRoundRobin.people) assert rr.get_who_to_nag('2019-02-25') == {} assert rr.get_who_to_nag('2019-02-28') == {'*****@*****.**': ['']} assert rr.get_who_to_nag('2019-03-05') == {'*****@*****.**': ['']} assert rr.get_who_to_nag('2019-03-07') == {'*****@*****.**': ['']} assert rr.get_who_to_nag('2019-03-10') == {'*****@*****.**': ['']} with patch.object(RoundRobin, 'is_mozilla', return_value=False): rr = RoundRobin(rr={'team': TestRoundRobin.config}, people=TestRoundRobin.people) self.assertRaises(BadFallback, rr.get_who_to_nag, '2019-03-01')
def test_get_who_to_nag(self): rr = RoundRobin(rr={'team': TestRoundRobin.config}, people=TestRoundRobin.people) empty = {'team': {'nobody': True, 'persons': []}} assert rr.get_who_to_nag('2019-02-25') == {} assert rr.get_who_to_nag('2019-03-01') == {'*****@*****.**': empty} assert rr.get_who_to_nag('2019-03-05') == {'*****@*****.**': empty} assert rr.get_who_to_nag('2019-03-07') == {'*****@*****.**': empty} assert rr.get_who_to_nag('2019-03-10') == {'*****@*****.**': empty} with patch.object(People, 'get_moz_mail', return_value=None): rr = RoundRobin(rr={'team': TestRoundRobin.config}, people=TestRoundRobin.people) self.assertRaises(BadFallback, rr.get_who_to_nag, '2019-03-01')
def test_get_who_to_nag(self): rr = RoundRobin(rr={"team": TestRoundRobin.config}, people=TestRoundRobin.people) empty = {"team": {"nobody": True, "persons": []}} assert rr.get_who_to_nag("2019-02-25") == {} assert rr.get_who_to_nag("2019-03-01") == {"*****@*****.**": empty} assert rr.get_who_to_nag("2019-03-05") == {"*****@*****.**": empty} assert rr.get_who_to_nag("2019-03-07") == {"*****@*****.**": empty} assert rr.get_who_to_nag("2019-03-10") == {"*****@*****.**": empty} with patch.object(People, "get_moz_mail", return_value=None): rr = RoundRobin(rr={"team": TestRoundRobin.config}, people=TestRoundRobin.people) self.assertRaises(BadFallback, rr.get_who_to_nag, "2019-03-01")
def test_get(self): with patch.object(RoundRobin, 'get_nick', new=TestRoundRobin._get_nick): rr = RoundRobin( rr={'team': TestRoundRobin.config}, people=TestRoundRobin.people ) assert rr.get(self.mk_bug('P1::C1'), '2019-02-17') == ( '*****@*****.**', 'ab', ) assert rr.get(self.mk_bug('P2::C2'), '2019-02-17') == ( '*****@*****.**', 'ab', ) assert rr.get(self.mk_bug('P3::C3'), '2019-02-17') == ( '*****@*****.**', 'ef', ) assert rr.get(self.mk_bug('P1::C1'), '2019-02-24') == ( '*****@*****.**', 'cd', ) assert rr.get(self.mk_bug('P2::C2'), '2019-02-24') == ( '*****@*****.**', 'cd', ) assert rr.get(self.mk_bug('P3::C3'), '2019-02-24') == ( '*****@*****.**', 'ab', ) assert rr.get(self.mk_bug('P1::C1'), '2019-02-28') == ( '*****@*****.**', 'ef', ) assert rr.get(self.mk_bug('P2::C2'), '2019-02-28') == ( '*****@*****.**', 'ef', ) assert rr.get(self.mk_bug('P3::C3'), '2019-02-28') == ( '*****@*****.**', 'cd', ) assert rr.get(self.mk_bug('P1::C1'), '2019-03-05') == ( '*****@*****.**', 'ef', ) assert rr.get(self.mk_bug('P2::C2'), '2019-03-05') == ( '*****@*****.**', 'ef', ) assert rr.get(self.mk_bug('P3::C3'), '2019-03-05') == ( '*****@*****.**', 'cd', ) assert rr.get(self.mk_bug('P1::C1'), '2019-03-08') == ( '*****@*****.**', 'gh', ) assert rr.get(self.mk_bug('P2::C2'), '2019-03-08') == ( '*****@*****.**', 'gh', ) assert rr.get(self.mk_bug('P3::C3'), '2019-03-08') == ( '*****@*****.**', 'gh', ) assert rr.get(self.mk_bug('Foo::Bar'), '2019-03-01') == ( '*****@*****.**', 'ij', )
class NoPriority(BzCleaner, Nag): def __init__(self, typ): super(NoPriority, self).__init__() assert typ in {'first', 'second'} self.typ = typ self.lookup_first = utils.get_config(self.name(), 'first-step', 2) self.lookup_second = utils.get_config(self.name(), 'second-step', 4) self.escalation = Escalation( self.people, data=utils.get_config(self.name(), 'escalation-{}'.format(typ)), blacklist=utils.get_config('workflow', 'supervisor_blacklist', []), ) self.round_robin = RoundRobin(people=self.people) def description(self): return 'Bugs without a priority set' def name(self): return 'workflow-no-priority' def template(self): return 'workflow_no_priority.html' def needinfo_template(self): return 'workflow_no_priority_comment.txt' def nag_template(self): return self.template() def subject(self): return 'Bugs without a priority set' def get_extra_for_template(self): return { 'nweeks': self.lookup_first if self.typ == 'first' else self.lookup_second } def get_extra_for_needinfo_template(self): return self.get_extra_for_template() def get_extra_for_nag_template(self): return self.get_extra_for_template() def has_product_component(self): return True def ignore_meta(self): return True def columns(self): return ['component', 'id', 'summary'] def get_mail_to_auto_ni(self, bug): if self.typ == 'second': return None mail, nick = self.round_robin.get(bug, self.date) return {'mail': mail, 'nickname': nick} def set_people_to_nag(self, bug, buginfo): priority = 'default' if not self.filter_bug(priority): return None owner, _ = self.round_robin.get(bug, self.date) real_owner = bug['triage_owner'] self.add_triage_owner( owner, utils.get_config('workflow', 'components'), real_owner=real_owner ) if not self.add(owner, buginfo, priority=priority): self.add_no_manager(buginfo['id']) return bug def get_bz_params(self, date): fields = ['triage_owner', 'flags'] comps = utils.get_config('workflow', 'components') params = { 'component': comps, 'include_fields': fields, 'resolution': '---', 'f1': 'priority', 'o1': 'equals', 'v1': '--', } self.date = lmdutils.get_date_ymd(date) if self.typ == 'first': params.update( { 'f2': 'flagtypes.name', 'o2': 'notequals', 'v2': 'needinfo?', 'f3': 'creation_ts', 'o3': 'lessthaneq', 'v3': self.date - relativedelta(days=self.lookup_first * 7), 'f4': 'creation_ts', 'o4': 'greaterthan', 'v4': self.date - relativedelta(days=self.lookup_second * 7), } ) else: params.update( { 'f2': 'creation_ts', 'o2': 'lessthaneq', 'v2': self.date - relativedelta(days=self.lookup_second * 7), } ) return params
def test_get(self): with patch.object(RoundRobin, "get_nick", new=TestRoundRobin._get_nick): rr = RoundRobin( rr={"team": TestRoundRobin.config}, people=TestRoundRobin.people ) assert rr.get(self.mk_bug("P1::C1"), "2019-02-17") == ( "*****@*****.**", "ab", ) assert rr.get(self.mk_bug("P2::C2"), "2019-02-17") == ( "*****@*****.**", "ab", ) assert rr.get(self.mk_bug("P3::C3"), "2019-02-17") == ( "*****@*****.**", "ef", ) assert rr.get(self.mk_bug("P1::C1"), "2019-02-24") == ( "*****@*****.**", "cd", ) assert rr.get(self.mk_bug("P2::C2"), "2019-02-24") == ( "*****@*****.**", "cd", ) assert rr.get(self.mk_bug("P3::C3"), "2019-02-24") == ( "*****@*****.**", "ab", ) assert rr.get(self.mk_bug("P1::C1"), "2019-02-28") == ( "*****@*****.**", "ef", ) assert rr.get(self.mk_bug("P2::C2"), "2019-02-28") == ( "*****@*****.**", "ef", ) assert rr.get(self.mk_bug("P3::C3"), "2019-02-28") == ( "*****@*****.**", "cd", ) assert rr.get(self.mk_bug("P1::C1"), "2019-03-05") == ( "*****@*****.**", "ef", ) assert rr.get(self.mk_bug("P2::C2"), "2019-03-05") == ( "*****@*****.**", "ef", ) assert rr.get(self.mk_bug("P3::C3"), "2019-03-05") == ( "*****@*****.**", "cd", ) assert rr.get(self.mk_bug("P1::C1"), "2019-03-08") == ( "*****@*****.**", "gh", ) assert rr.get(self.mk_bug("P2::C2"), "2019-03-08") == ( "*****@*****.**", "gh", ) assert rr.get(self.mk_bug("P3::C3"), "2019-03-08") == ( "*****@*****.**", "gh", ) assert rr.get(self.mk_bug("Foo::Bar"), "2019-03-01") == ( "*****@*****.**", "ij", )
def test_get(self): with patch.object(RoundRobin, 'get_nick', new=TestRoundRobin._get_nick): rr = RoundRobin(rr={'team': TestRoundRobin.config}, people=TestRoundRobin.people) assert rr.get(self.mk_bug('P1::C1'), '2019-02-17') == ( '*****@*****.**', 'ab', ) assert rr.get(self.mk_bug('P2::C2'), '2019-02-17') == ( '*****@*****.**', 'ab', ) assert rr.get(self.mk_bug('P3::C3'), '2019-02-17') == ( '*****@*****.**', 'ef', ) assert rr.get(self.mk_bug('P1::C1'), '2019-02-24') == ( '*****@*****.**', 'cd', ) assert rr.get(self.mk_bug('P2::C2'), '2019-02-24') == ( '*****@*****.**', 'cd', ) assert rr.get(self.mk_bug('P3::C3'), '2019-02-24') == ( '*****@*****.**', 'ab', ) assert rr.get(self.mk_bug('P1::C1'), '2019-02-28') == ( '*****@*****.**', 'cd', ) assert rr.get(self.mk_bug('P2::C2'), '2019-02-28') == ( '*****@*****.**', 'cd', ) assert rr.get(self.mk_bug('P3::C3'), '2019-02-28') == ( '*****@*****.**', 'ab', ) assert rr.get(self.mk_bug('P1::C1'), '2019-03-05') == ( '*****@*****.**', 'ef', ) assert rr.get(self.mk_bug('P2::C2'), '2019-03-05') == ( '*****@*****.**', 'ef', ) assert rr.get(self.mk_bug('P3::C3'), '2019-03-05') == ( '*****@*****.**', 'cd', ) assert rr.get(self.mk_bug('P1::C1'), '2019-03-08') == ( '*****@*****.**', 'gh', ) assert rr.get(self.mk_bug('P2::C2'), '2019-03-08') == ( '*****@*****.**', 'gh', ) assert rr.get(self.mk_bug('P3::C3'), '2019-03-08') == ( '*****@*****.**', 'gh', ) assert rr.get(self.mk_bug('Foo::Bar'), '2019-03-01') == ( '*****@*****.**', 'ij', )
class ToTriage(BzCleaner, Nag): def __init__(self): super(ToTriage, self).__init__() self.escalation = Escalation(self.people, data=self.get_config('escalation')) self.round_robin = RoundRobin( people=self.people, teams=self.get_config('teams', []) ) self.components = self.round_robin.get_components() def description(self): return 'Bugs to triage' def nag_template(self): return self.template() def has_default_product(self): return False def has_product_component(self): return True def ignore_meta(self): return True def columns(self): return ['component', 'id', 'summary', 'type'] def columns_nag(self): return self.columns() def handle_bug(self, bug, data): bugid = str(bug['id']) data[bugid] = {'type': bug['type']} return bug def set_people_to_nag(self, bug, buginfo): priority = 'default' if not self.filter_bug(priority): return None owner, _ = self.round_robin.get(bug, self.date) real_owner = bug['triage_owner'] buginfo['type'] = bug['type'] self.add_triage_owner(owner, real_owner=real_owner) if not self.add(owner, buginfo, priority=priority): self.add_no_manager(buginfo['id']) return bug def get_bz_params(self, date): self.date = lmdutils.get_date_ymd(date) prods, comps = utils.get_products_components(self.components) fields = ['triage_owner', 'type'] params = { 'include_fields': fields, 'product': list(prods), 'component': list(comps), 'resolution': '---', 'f1': 'priority', 'o1': 'equals', 'v1': '--', 'f2': 'flagtypes.name', 'o2': 'notequals', 'v2': 'needinfo?', } return params