Checking actual service in start_kpi_service
This commit is contained in:
parent
da5e6765af
commit
3700927559
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,3 +4,4 @@
|
||||
local_settings.py
|
||||
.coverage
|
||||
worker.log
|
||||
worker.log.*
|
||||
|
@ -84,7 +84,7 @@ def start_kpi_tracking(lifecycle, raw):
|
||||
if raw.event != "compute.instance.update":
|
||||
return
|
||||
|
||||
if "api" not in raw.host:
|
||||
if "api" not in raw.service:
|
||||
return
|
||||
|
||||
tracker = STACKDB.create_request_tracker(request_id=raw.request_id,
|
||||
|
@ -226,7 +226,7 @@ class StacktachLifecycleTestCase(unittest.TestCase):
|
||||
def test_start_kpi_tracking_not_from_api(self):
|
||||
raw = self.mox.CreateMockAnything()
|
||||
raw.event = 'compute.instance.update'
|
||||
raw.host = 'compute'
|
||||
raw.service = 'compute'
|
||||
self.mox.ReplayAll()
|
||||
views.start_kpi_tracking(None, raw)
|
||||
self.mox.VerifyAll()
|
||||
@ -236,7 +236,7 @@ class StacktachLifecycleTestCase(unittest.TestCase):
|
||||
tracker = self.mox.CreateMockAnything()
|
||||
when = utils.decimal_utc()
|
||||
raw = utils.create_raw(self.mox, when, 'compute.instance.update',
|
||||
host='api')
|
||||
host='nova.example.com', service='api')
|
||||
views.STACKDB.create_request_tracker(lifecycle=lifecycle,
|
||||
request_id=REQUEST_ID_1,
|
||||
start=when,
|
||||
@ -248,6 +248,16 @@ class StacktachLifecycleTestCase(unittest.TestCase):
|
||||
views.start_kpi_tracking(lifecycle, raw)
|
||||
self.mox.VerifyAll()
|
||||
|
||||
def test_start_kpi_tracking_not_using_host(self):
|
||||
lifecycle = self.mox.CreateMockAnything()
|
||||
tracker = self.mox.CreateMockAnything()
|
||||
when = utils.decimal_utc()
|
||||
raw = utils.create_raw(self.mox, when, 'compute.instance.update',
|
||||
host='api.example.com', service='compute')
|
||||
self.mox.ReplayAll()
|
||||
views.start_kpi_tracking(lifecycle, raw)
|
||||
self.mox.VerifyAll()
|
||||
|
||||
def test_update_kpi_no_trackers(self):
|
||||
raw = self.mox.CreateMockAnything()
|
||||
raw.request_id = REQUEST_ID_1
|
||||
|
@ -47,9 +47,10 @@ def create_nova_notif(request_id=None, instance=INSTANCE_ID_1, type_id='1',
|
||||
|
||||
def create_raw(mox, when, event, instance=INSTANCE_ID_1,
|
||||
request_id=REQUEST_ID_1, state='active', old_task='',
|
||||
host='compute', json_str=''):
|
||||
host='c.example.com', service='compute', json_str=''):
|
||||
raw = mox.CreateMockAnything()
|
||||
raw.host = host
|
||||
raw.service = service
|
||||
raw.instance = instance
|
||||
raw.event = event
|
||||
raw.when = when
|
||||
|
Loading…
x
Reference in New Issue
Block a user