Merge "HTTPS HMs need the same validation path as HTTP"

This commit is contained in:
Zuul 2018-10-03 16:17:20 +00:00 committed by Gerrit Code Review
commit 2ea3ed8c48
2 changed files with 18 additions and 1 deletions

View File

@ -114,7 +114,8 @@ class HealthMonitorController(base.BaseController):
raise exceptions.InvalidOption(value='None',
option=consts.MAX_RETRIES)
if hm_dict[consts.TYPE] != consts.HEALTH_MONITOR_HTTP:
if hm_dict[consts.TYPE] not in (consts.HEALTH_MONITOR_HTTP,
consts.HEALTH_MONITOR_HTTPS):
if hm_dict.get(consts.HTTP_METHOD, None):
raise exceptions.InvalidOption(
value=consts.HTTP_METHOD, option='health monitors of '

View File

@ -680,6 +680,22 @@ class TestHealthMonitor(base.BaseAPITest):
self.assertEqual('/', api_hm.get('url_path'))
self.assertEqual('200', api_hm.get('expected_codes'))
def test_create_https_full(self):
api_hm = self.create_health_monitor(
self.pool_id, constants.HEALTH_MONITOR_HTTPS,
1, 1, 1, 1, admin_state_up=False, expected_codes='200',
http_method='GET', name='Test HM', url_path='/').get(self.root_tag)
self.assertEqual(constants.HEALTH_MONITOR_HTTPS, api_hm.get('type'))
self.assertEqual(1, api_hm.get('delay'))
self.assertEqual(1, api_hm.get('timeout'))
self.assertEqual(1, api_hm.get('max_retries_down'))
self.assertEqual(1, api_hm.get('max_retries'))
self.assertFalse(api_hm.get('admin_state_up'))
self.assertEqual('Test HM', api_hm.get('name'))
self.assertEqual('GET', api_hm.get('http_method'))
self.assertEqual('/', api_hm.get('url_path'))
self.assertEqual('200', api_hm.get('expected_codes'))
def test_create_udp_case(self):
api_hm = self.create_health_monitor(
self.udp_pool_with_listener_id,