[in C:\Projects\alerta\alerta-contrib\venv\lib\site-packages\alerta\webhooks\__init__.py:23]
2019-12-18 12:18:47,888 - alerta.plugins[10936]: WARNING - [POLICY] Alert environment does not match one of Production, Staging, Sandbox [in C:\Projects\alerta\alerta-contrib\venv\lib\site-packages\alerta\plugins\reject.py:32]
201 != 403
Expected :403
Actual :201
self = <test_sentry.SentryWebhookTestCase testMethod=test_sentry_webhook>
first = 403, second = 201, msg = None
def _patched_equals(self, first, second, msg=None):
try:
> old(self, first, second, msg)
I have custom environments:
ALLOWED_ENVIRONMENTS=['Production','Staging', 'Sandbox']
I didn't understand at first because I still had Production in the list, so it should be working. But then, digging a little I found this in alerta_sentry.py:
The condition is always False because payload.get('event')['sentry.interfaces.Http']['env'] is wrong. We should do payload.get('event')['sentry.interfaces.Http']['env']['ENV'] which is what is in the payload.
The test on Sentry webhook is failing.
Test result:
I have custom environments:
ALLOWED_ENVIRONMENTS=['Production','Staging', 'Sandbox']
I didn't understand at first because I still had Production in the list, so it should be working. But then, digging a little I found this in alerta_sentry.py:
The condition is always False because
payload.get('event')['sentry.interfaces.Http']['env']
is wrong. We should dopayload.get('event')['sentry.interfaces.Http']['env']['ENV']
which is what is in the payload.I'll do a PR to correct this.