Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
Remove celery check from pingdom (#944)
Browse files Browse the repository at this point in the history
* Remove celery check from pingdom

* Remove celery pingdom checks
  • Loading branch information
PippoRaimondiDIT authored Jun 4, 2024
1 parent eb0eb75 commit 23e88d8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 28 deletions.
1 change: 0 additions & 1 deletion app/pingdom/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,5 @@ def check(self):

services_to_check = (
CheckDatabase,
CheckCelery,
CheckRedis,
)
29 changes: 2 additions & 27 deletions app/pingdom/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from rest_framework.reverse import reverse
from redis.exceptions import RedisError

from app.pingdom.services import CheckCelery, CheckDatabase, CheckRedis
from app.pingdom.services import CheckDatabase, CheckRedis
from app.pingdom.views import ping


Expand All @@ -17,11 +17,9 @@

class ServiceHealthCheckPingdomTestCase(test_dh_utils.DataHubUtilsTests):
@patch.object(CheckDatabase, 'check')
@patch.object(CheckCelery, 'check')
@patch.object(CheckRedis, 'check')
def test_ping_success(self, check_database, check_celery, check_redis):
def test_ping_success(self, check_database, check_redis):
check_database.return_value = (True, "")
check_celery.return_value = (True, "")
check_redis.return_value = (True, "")

response = ping({})
Expand All @@ -40,17 +38,6 @@ def test_ping_failure(self, check_database):
assert '<!--Error message-->' in str(response.content)
assert response.headers['content-type'] == 'text/xml'

@patch.object(CheckCelery, 'check')
def test_all_good(self, check_celery):
"""Fake Celery for Circle CI"""
check_celery.return_value = (True, "")
url = reverse('ping')
response = self.client.get(url)

assert response.status_code == status.HTTP_200_OK
assert '<status>OK</status>' in str(response.content)
assert response.headers['content-type'] == 'text/xml'

def test_check_database_fail(self):
url = reverse('ping')

Expand All @@ -64,18 +51,6 @@ def test_check_database_fail(self):
assert '<status>FALSE</status>' in str(response.content)
assert response.headers['content-type'] == 'text/xml'

def test_check_celery_fail(self):
url = reverse('ping')
with patch(
'app.enquiries.celery.app.control.inspect.stats',
return_value=None
):
response = self.client.get(url)

assert response.status_code == status.HTTP_500_INTERNAL_SERVER_ERROR
assert '<status>FALSE</status>' in str(response.content)
assert response.headers['content-type'] == 'text/xml'

def test_check_redis_fail(self):
url = reverse('ping')
with patch(
Expand Down

0 comments on commit 23e88d8

Please sign in to comment.