Commit c703834e by Nimisha Asthagiri

Move heartbeat from common to openedx/core

parent 256223d0
......@@ -44,7 +44,7 @@ urlpatterns = patterns(
url(r'^event$', 'contentstore.views.event', name='event'),
url(r'^xmodule/', include('pipeline_js.urls')),
url(r'^heartbeat$', include('heartbeat.urls')),
url(r'^heartbeat$', include('openedx.core.djangoapps.heartbeat.urls')),
url(r'^user_api/', include('openedx.core.djangoapps.user_api.legacy_urls')),
......
......@@ -63,7 +63,7 @@ urlpatterns = (
url(r'^password_reset_done/$', 'django.contrib.auth.views.password_reset_done',
name='password_reset_done'),
url(r'^heartbeat$', include('heartbeat.urls')),
url(r'^heartbeat$', include('openedx.core.djangoapps.heartbeat.urls')),
# Note: these are older versions of the User API that will eventually be
# subsumed by api/user listed below.
......
......@@ -27,7 +27,7 @@ class HeartbeatTestCase(ModuleStoreTestCase):
self.assertEqual(response.status_code, 200)
def test_sql_fail(self):
with patch('heartbeat.views.connection') as mock_connection:
with patch('openedx.core.djangoapps.heartbeat.views.connection') as mock_connection:
mock_connection.cursor.return_value.execute.side_effect = DatabaseError
response = self.client.get(self.heartbeat_url)
self.assertEqual(response.status_code, 503)
......@@ -35,7 +35,7 @@ class HeartbeatTestCase(ModuleStoreTestCase):
self.assertIn('SQL', response_dict)
def test_modulestore_fail(self):
with patch('heartbeat.views.modulestore') as mock_modulestore:
with patch('openedx.core.djangoapps.heartbeat.views.modulestore') as mock_modulestore:
mock_modulestore.return_value.heartbeat.side_effect = HeartbeatFailure('msg', 'service')
response = self.client.get(self.heartbeat_url)
self.assertEqual(response.status_code, 503)
"""
Urls for verifying health (heartbeat) of the app.
"""
from django.conf.urls import url, patterns
urlpatterns = patterns(
'',
url(r'^$', 'heartbeat.views.heartbeat', name='heartbeat'),
url(r'^$', 'openedx.core.djangoapps.heartbeat.views.heartbeat', name='heartbeat'),
)
"""
Views for verifying the health (heartbeat) of the app.
"""
from xmodule.modulestore.django import modulestore
from dogapi import dog_stats_api
from util.json_request import JsonResponse
......@@ -7,7 +10,7 @@ from xmodule.exceptions import HeartbeatFailure
@dog_stats_api.timed('edxapp.heartbeat')
def heartbeat(request):
def heartbeat(request): # pylint: disable=unused-argument
"""
Simple view that a loadbalancer can check to verify that the app is up. Returns a json doc
of service id: status or message. If the status for any service is anything other than True,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment