Permalink
Browse files

added a heartbeat API

  • Loading branch information...
1 parent 4401442 commit a76bed2baa8b94d7c5a526c738f0b090d17a454b @tarekziade tarekziade committed Mar 21, 2013
Showing with 14 additions and 0 deletions.
  1. +5 −0 monolith/web/tests/tests_views.py
  2. +9 −0 monolith/web/views.py
@@ -77,3 +77,8 @@ def test_query_time_invalid_json(self):
res = self.app.post('/v1/time', '{"que"""', expect_errors=True)
self.assertEqual(res.status_code, 400)
self.assertEqual(res.json['status'], 'error')
+
+ def test_hb(self):
+ res = self.app.get('/__heartbeat__')
+ self.assertEqual(res.status_code, 200)
+ self.assertEqual(res.json['status'], 'OK')
View
@@ -14,6 +14,7 @@ class ElasticSearchQuery(MappingSchema):
names = SchemaNode(Seq(), location='body')
+
info = Service(name='info', path='/',
cors_policy={'origins': ('*',), 'credentials': True})
@@ -52,3 +53,11 @@ def query_es_time(request):
request.errors.status = e.status_code
request.errors.add('body', description=e.error)
return {}
+
+
+heartbeat = Service(name='hb', path='/__heartbeat__')
+
+
+@heartbeat.get(renderer='json')
+def heartbeat(request):
+ return {'status': 'OK'}

0 comments on commit a76bed2

Please sign in to comment.