HTTPS HMs need the same validation path as HTTP++

Second take on this patch, didn't realize the Create and the Update
paths were different. Same exact change as the other patch, but in the
update validation method.

For reference: https://review.openstack.org/#/c/604924/

Change-Id: I916ccb7658d4849b3c208405ec40fc1a0eab4ba7
This commit is contained in:
Adam Harwell 2018-10-04 16:08:00 -07:00
parent 2ea3ed8c48
commit 2c88c553ae
2 changed files with 25 additions and 1 deletions

View File

@ -257,7 +257,8 @@ class HealthMonitorController(base.BaseController):
return db_hm
def _validate_update_hm(self, db_hm, health_monitor):
if db_hm.type != consts.HEALTH_MONITOR_HTTP:
if db_hm.type not in (consts.HEALTH_MONITOR_HTTP,
consts.HEALTH_MONITOR_HTTPS):
if health_monitor.http_method != wtypes.Unset:
raise exceptions.InvalidOption(
value=consts.HTTP_METHOD, option='health monitors of '

View File

@ -1129,6 +1129,29 @@ class TestHealthMonitor(base.BaseAPITest):
healthmonitor_id=api_hm.get('id'))).json.get(self.root_tag)
self.assertEqual(2, response[constants.MAX_RETRIES])
def test_update_HTTPS(self):
api_hm = self.create_health_monitor(
self.pool_with_listener_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.set_lb_status(self.lb_id)
self.assertEqual('/', api_hm[constants.URL_PATH])
new_hm = {constants.URL_PATH: '/health'}
self.put(
self.HM_PATH.format(healthmonitor_id=api_hm.get('id')),
self._build_body(new_hm))
self.assert_correct_status(
lb_id=self.lb_id, listener_id=self.listener_id,
pool_id=self.pool_with_listener_id, hm_id=api_hm.get('id'),
lb_prov_status=constants.PENDING_UPDATE,
listener_prov_status=constants.PENDING_UPDATE,
pool_prov_status=constants.PENDING_UPDATE,
hm_prov_status=constants.PENDING_UPDATE)
response = self.get(self.HM_PATH.format(
healthmonitor_id=api_hm.get('id'))).json.get(self.root_tag)
self.assertEqual('/health', response[constants.URL_PATH])
def test_update_TCP(self):
api_hm = self.create_health_monitor(
self.pool_with_listener_id,