Change endpoint_type parameter

Replace endpoint_type parameter by os_endpoint_type parameter
expected by ceilometerclient.

Change-Id: I676247b289f8efa7c047a34dc9333361d094b024
Closes-Bug: #1257232
This commit is contained in:
Ala Rezmerita 2013-12-18 11:50:20 +01:00 committed by Gordon Chung
parent dfed6ac2a3
commit d6639d849f
4 changed files with 45 additions and 2 deletions

View File

@ -53,7 +53,7 @@ class Evaluator(object):
os_password=auth_config.os_password,
os_username=auth_config.os_username,
cacert=auth_config.os_cacert,
endpoint_type=auth_config.os_endpoint_type,
os_endpoint_type=auth_config.os_endpoint_type,
)
self.api_client = ceiloclient.get_client(2, **creds)
return self.api_client

View File

@ -85,7 +85,7 @@ class AlarmService(object):
os_password=auth_config.os_password,
os_username=auth_config.os_username,
cacert=auth_config.os_cacert,
endpoint_type=auth_config.os_endpoint_type,
os_endpoint_type=auth_config.os_endpoint_type,
)
self.api_client = ceiloclient.get_client(2, **creds)
return self.api_client

View File

@ -27,6 +27,7 @@ from ceilometer.storage import models
from ceilometer.tests.alarm.evaluator import base
from ceilometerclient import exc
from ceilometerclient.v2 import statistics
from oslo.config import cfg
class TestEvaluate(base.TestEvaluatorBase):
@ -289,3 +290,24 @@ class TestEvaluate(base.TestEvaluatorBase):
'op': 'ge',
'value': '2012-07-02T10:39:00'},
])
def test_threshold_endpoint_types(self):
endpoint_types = ["internalURL", "publicURL"]
for endpoint_type in endpoint_types:
cfg.CONF.set_override('os_endpoint_type',
endpoint_type,
group='service_credentials')
with mock.patch('ceilometerclient.client.get_client') as client:
self.evaluator.api_client = None
self._evaluate_all_alarms()
conf = cfg.CONF.service_credentials
expected = [mock.call(2,
os_auth_url=conf.os_auth_url,
os_region_name=conf.os_region_name,
os_tenant_name=conf.os_tenant_name,
os_password=conf.os_password,
os_username=conf.os_username,
cacert=conf.os_cacert,
os_endpoint_type=conf.os_endpoint_type)]
actual = client.call_args_list
self.assertEqual(actual, expected)

View File

@ -83,3 +83,24 @@ class TestSingletonAlarmService(test.BaseTestCase):
self.singleton.start()
self.singleton._evaluate_assigned_alarms()
self.threshold_eval.evaluate.assert_called_once_with(alarms[1])
def test_singleton_endpoint_types(self):
endpoint_types = ["internalURL", "publicURL"]
for endpoint_type in endpoint_types:
cfg.CONF.set_override('os_endpoint_type',
endpoint_type,
group='service_credentials')
with mock.patch('ceilometerclient.client.get_client') as client:
self.singleton.api_client = None
self.singleton._evaluate_assigned_alarms()
conf = cfg.CONF.service_credentials
expected = [mock.call(2,
os_auth_url=conf.os_auth_url,
os_region_name=conf.os_region_name,
os_tenant_name=conf.os_tenant_name,
os_password=conf.os_password,
os_username=conf.os_username,
cacert=conf.os_cacert,
os_endpoint_type=conf.os_endpoint_type)]
actual = client.call_args_list
self.assertEqual(actual, expected)