Пример #1
0
 def test_low_priority_1p(self):
     incident = self._non_urgent_incident()
     with _mocking_weekend():
         result = pager_parrot.format_message(incident, _CHANNEL_1P)
         self.assertNotIn('@channel', result)
         self.assertNotIn('@here', result)
         self.assertIn('text and email the person on-ping', result)
Пример #2
0
 def test_low_priority_3p(self):
     incident = self._non_urgent_incident()
     with _mocking_weekend():
         result = pager_parrot.format_message(incident, _CHANNEL_3P)
         self.assertNotIn('@channel', result)
         self.assertNotIn('@here', result)
         self.assertIn('dev team has been alerted', result)
Пример #3
0
    def post(self):
        logging.info("Processing %s" % self.request.body)
        payload = json.loads(self.request.body)

        global pagerduty_ids_seen
        for message in payload['messages']:
            if (message['id'] not in pagerduty_ids_seen
                    and message['type'] == 'incident.trigger'):
                should_ping = pager_parrot.consider_ping()
                # Only trigger if we haven't seen the message, and if it's a
                # trigger, rather than an acknowledgement or resolve.
                for channel in pager_parrot.CHANNELS:
                    resp = _send_to_slack(
                        pager_parrot.format_message(
                            message['data']['incident'],
                            channel,
                            should_ping=should_ping),
                        channel,
                        'Pager Parrot',
                        ':parrot:',
                        thread=pager_parrot.get_channel_thread(channel))

                    # We should stash any thread info for future use
                    msg = resp.json()
                    if 'ts' in msg:
                        pager_parrot.set_channel_thread(channel, msg['ts'])

                pagerduty_ids_seen.add(message['id'])
Пример #4
0
 def test_low_priority_1p(self):
     incident = self._non_urgent_incident()
     with _mocking_weekend():
         result = pager_parrot.format_message(incident, _CHANNEL_1P)
         self.assertNotIn('@channel', result)
         self.assertNotIn('@here', result)
         self.assertIn('text and email the person on-ping', result)
Пример #5
0
 def test_low_priority_3p(self):
     incident = self._non_urgent_incident()
     with _mocking_weekend():
         result = pager_parrot.format_message(incident, _CHANNEL_3P)
         self.assertNotIn('@channel', result)
         self.assertNotIn('@here', result)
         self.assertIn('dev team has been alerted', result)
Пример #6
0
    def post(self):
        logging.info("Processing %s" % self.request.body)
        payload = json.loads(self.request.body)

        global pagerduty_ids_seen
        for message in payload['messages']:
            if (message['id'] not in pagerduty_ids_seen and
                    message['type'] == 'incident.trigger'
                    ):
                should_ping = pager_parrot.consider_ping()
                # Only trigger if we haven't seen the message, and if it's a
                # trigger, rather than an acknowledgement or resolve.
                for channel in pager_parrot.CHANNELS:
                    _send_to_slack(
                        pager_parrot.format_message(
                            message['data']['incident'], channel,
                            should_ping=should_ping),
                        channel, 'Pager Parrot', ':parrot:')
                pagerduty_ids_seen.add(message['id'])
Пример #7
0
    def post(self):
        logging.info("Processing %s" % self.request.body)
        payload = json.loads(self.request.body)

        global pagerduty_ids_seen
        for message in payload['messages']:
            if (message['id'] not in pagerduty_ids_seen and
                    message['type'] == 'incident.trigger'
                    ):
                should_ping = pager_parrot.consider_ping()
                # Only trigger if we haven't seen the message, and if it's a
                # trigger, rather than an acknowledgement or resolve.
                for channel in pager_parrot.CHANNELS:
                    _send_to_slack(
                        pager_parrot.format_message(
                            message['data']['incident'], channel,
                            should_ping=should_ping),
                        channel, 'Pager Parrot', ':parrot:')
                pagerduty_ids_seen.add(message['id'])
Пример #8
0
 def test_medium_priority_1p(self):
     incident = self._non_urgent_incident()
     with _mocking_weekday():
         result = pager_parrot.format_message(incident, _CHANNEL_1P)
         self.assertIn('@here', result)
         self.assertIn('text and email the support DRI', result)
Пример #9
0
 def test_high_priority_3p_weekday(self):
     incident = self._urgent_incident()
     with _mocking_weekday():
         result = pager_parrot.format_message(incident, _CHANNEL_3P)
         self.assertIn('@channel', result)
         self.assertIn('dev team has been alerted', result)
Пример #10
0
 def test_high_priority_1p_weekend(self):
     incident = self._urgent_incident()
     with _mocking_weekend():
         result = pager_parrot.format_message(incident, _CHANNEL_1P)
         self.assertIn('@channel', result)
         self.assertIn('start calling the P911 list', result)
Пример #11
0
 def test_p0_pings_channel_in_support_on_weekday(self):
     incident = self._non_urgent_incident()
     with _mocking_weekday():
         result = pager_parrot.format_message(incident, '#support')
         self.assertIn('@channel', result)
Пример #12
0
 def test_p0_pings_channel_in_1s0s_on_weekday(self):
     incident = self._non_urgent_incident()
     with _mocking_weekday():
         result = pager_parrot.format_message(incident, '#1s-and-0s')
         self.assertIn('@channel', result)
Пример #13
0
 def test_medium_priority_1p(self):
     incident = self._non_urgent_incident()
     with _mocking_weekday():
         result = pager_parrot.format_message(incident, _CHANNEL_1P)
         self.assertIn('@here', result)
         self.assertIn('text and email the support DRI', result)
Пример #14
0
 def test_high_priority_3p_weekday(self):
     incident = self._urgent_incident()
     with _mocking_weekday():
         result = pager_parrot.format_message(incident, _CHANNEL_3P)
         self.assertIn('@channel', result)
         self.assertIn('dev team has been alerted', result)
Пример #15
0
 def test_high_priority_1p_weekend(self):
     incident = self._urgent_incident()
     with _mocking_weekend():
         result = pager_parrot.format_message(incident, _CHANNEL_1P)
         self.assertIn('@channel', result)
         self.assertIn('start calling the P911 list', result)
Пример #16
0
 def test_p911_pings_channel_in_1s0s_and_support_on_weekend(self):
     incident = self._urgent_incident()
     with _mocking_weekend():
         for channel in ('#1s-and-0s', '#support'):
             result = pager_parrot.format_message(incident, channel)
             self.assertIn('@channel', result)
Пример #17
0
 def test_p911_pings_channel_in_1s0s_on_weekday(self):
     incident = self._urgent_incident()
     with _mocking_weekday():
         result = pager_parrot.format_message(incident, '#1s-and-0s')
         self.assertIn('@channel', result)