add healthcheck option

supported by oslo middleware
return 200 ok if asked via url /healthcheck

Change-Id: I5cc0100f32e3f1e83f8d9a31c03f020615fc85ab
This commit is contained in:
Eyal 2017-06-20 15:02:40 +03:00
parent 40fb89d4bf
commit 6d2c90817f
3 changed files with 36 additions and 0 deletions

View File

@ -2,11 +2,17 @@
use = egg:Paste#urlmap
/ = vitrageversions_pipeline
/v1 = vitragev1_noauth_pipeline
/healthcheck = healthcheck
[composite:vitrage+keystone]
use = egg:Paste#urlmap
/ = vitrageversions_pipeline
/v1 = vitragev1_keystone_pipeline
/healthcheck = healthcheck
[app:healthcheck]
use = egg:oslo.middleware#healthcheck
oslo_config_project = vitrage
[pipeline:vitrageversions_pipeline]
pipeline = cors http_proxy_to_wsgi vitrageversions

View File

@ -3,6 +3,7 @@ output_file = etc/vitrage/vitrage.conf
wrap_width = 79
namespace = vitrage
namespace = datasources
namespace = oslo.middleware.healthcheck
namespace = oslo.log
namespace = oslo.middleware
namespace = oslo.policy

View File

@ -0,0 +1,29 @@
# Copyright 2016 - Nokia Corporation
# Copyright 2014 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# noinspection PyPackageRequirements
from vitrage.tests.functional import api
class HealthTest(api.FunctionalTest):
def __init__(self, *args, **kwds):
super(HealthTest, self).__init__(*args, **kwds)
self.auth = 'keystone'
def test_health(self):
resp = self.app.get('/healthcheck')
self.assertEqual('200 OK', resp.status)