Merge "Enable healthcheck middleware"

This commit is contained in:
Zuul 2021-02-08 23:41:57 +00:00 committed by Gerrit Code Review
commit e450aca33b
3 changed files with 29 additions and 0 deletions

@ -5,6 +5,7 @@
[composite:osapi_share]
use = call:manila.api:root_app_factory
/: apiversions
/healthcheck: healthcheck
/v1: openstack_share_api
/v2: openstack_share_api_v2
@ -61,3 +62,8 @@ paste.filter_factory = keystonemiddleware.auth_token:filter_factory
[filter:cors]
paste.filter_factory = oslo_middleware.cors:filter_factory
oslo_config_project = manila
[app:healthcheck]
paste.app_factory = oslo_middleware:Healthcheck.app_factory
backends = disable_by_file
disable_by_file_path = /etc/manila/healthcheck_disable

@ -14,6 +14,8 @@
import ddt
from oslo_config import cfg
from oslo_serialization import jsonutils
import requests
from manila.tests.integrated import integrated_helpers
@ -86,3 +88,17 @@ class TestCORSMiddleware(integrated_helpers._IntegratedTestBase):
self.assertEqual(404, response.status)
self.assertEqual(acao_header_expected,
response.getheader('Access-Control-Allow-Origin'))
class TestHealthCheckMiddleware(integrated_helpers._IntegratedTestBase):
def test_healthcheck(self):
# We verify that we return a HTTP200 when calling api_get
url = 'http://%s:%s/healthcheck' % (self.osapi.host, self.osapi.port)
response = requests.request(
'GET',
url,
headers={'Accept': 'application/json'})
output = jsonutils.loads(response.content)
self.assertEqual(200, response.status_code)
self.assertEqual(['OK'], output['reasons'])

@ -0,0 +1,7 @@
---
features:
- |
The oslo.middleware /healthcheck is now activated by default in the Manila
api-paste.ini. Operators can use it to configure HAproxy or the monitoring
of Manila APIs. Edit the ``api-paste.ini`` file and remove any healthcheck
entries to disable this functionality.