tests: stop using Ceilometer legacy resource types
Change-Id: Ifb600c8b0d3eb0ebd9be9a3d69c5e20a1a394e28
This commit is contained in:
parent
eb827601af
commit
d59ae539e3
@ -508,15 +508,10 @@ class AodhClientGnocchiRulesTest(base.ClientTestBase):
|
||||
RESOURCE_ID = uuidutils.generate_uuid()
|
||||
|
||||
req = requests.post(
|
||||
os.environ.get("GNOCCHI_ENDPOINT") + "/v1/resource/instance",
|
||||
os.environ.get("GNOCCHI_ENDPOINT") + "/v1/resource/generic",
|
||||
auth=requests.auth.HTTPBasicAuth('admin', ''),
|
||||
json={
|
||||
"display_name": "myvm",
|
||||
"flavor_id": "2", "host": "blah",
|
||||
"id": RESOURCE_ID,
|
||||
"image_ref": "http://image",
|
||||
"project_id": "BD3A1E52-1C62-44CB-BF04-660BD88CD74D",
|
||||
"user_id": "BD3A1E52-1C62-44CB-BF04-660BD88CD74D",
|
||||
})
|
||||
self.assertEqual(201, req.status_code)
|
||||
|
||||
@ -526,7 +521,7 @@ class AodhClientGnocchiRulesTest(base.ClientTestBase):
|
||||
"--type gnocchi_resources_threshold "
|
||||
"--name alarm_gn1 --metric cpu_util "
|
||||
"--threshold 80 "
|
||||
"--resource-id %s --resource-type instance "
|
||||
"--resource-id %s --resource-type generic "
|
||||
"--aggregation-method last "
|
||||
"--project-id %s"
|
||||
% (RESOURCE_ID, PROJECT_ID)))
|
||||
@ -538,7 +533,7 @@ class AodhClientGnocchiRulesTest(base.ClientTestBase):
|
||||
self.assertEqual('last', alarm['aggregation_method'])
|
||||
self.assertEqual(RESOURCE_ID,
|
||||
alarm['resource_id'])
|
||||
self.assertEqual('instance', alarm['resource_type'])
|
||||
self.assertEqual('generic', alarm['resource_type'])
|
||||
|
||||
# CREATE FAIL MISSING PARAM
|
||||
self.assertRaises(exceptions.CommandFailed,
|
||||
@ -546,7 +541,7 @@ class AodhClientGnocchiRulesTest(base.ClientTestBase):
|
||||
params=(u"create "
|
||||
"--type gnocchi_resources_threshold "
|
||||
"--name alarm1 --metric cpu_util "
|
||||
"--resource-id %s --resource-type instance "
|
||||
"--resource-id %s --resource-type generic "
|
||||
"--aggregation-method last "
|
||||
"--project-id %s"
|
||||
% (RESOURCE_ID, PROJECT_ID)))
|
||||
@ -571,7 +566,7 @@ class AodhClientGnocchiRulesTest(base.ClientTestBase):
|
||||
self.assertEqual('90.0', alarm_show['threshold'])
|
||||
self.assertEqual('critical', alarm_show['severity'])
|
||||
self.assertEqual('last', alarm_show['aggregation_method'])
|
||||
self.assertEqual('instance', alarm_show['resource_type'])
|
||||
self.assertEqual('generic', alarm_show['resource_type'])
|
||||
|
||||
# GET BY NAME
|
||||
result = self.aodh(
|
||||
@ -583,7 +578,7 @@ class AodhClientGnocchiRulesTest(base.ClientTestBase):
|
||||
self.assertEqual('90.0', alarm_show['threshold'])
|
||||
self.assertEqual('critical', alarm_show['severity'])
|
||||
self.assertEqual('last', alarm_show['aggregation_method'])
|
||||
self.assertEqual('instance', alarm_show['resource_type'])
|
||||
self.assertEqual('generic', alarm_show['resource_type'])
|
||||
|
||||
# GET BY NAME AND ID ERROR
|
||||
self.assertRaises(exceptions.CommandFailed,
|
||||
@ -641,8 +636,8 @@ class AodhClientGnocchiRulesTest(base.ClientTestBase):
|
||||
"gnocchi_aggregation_by_resources_threshold "
|
||||
"--name alarm1 --metric cpu --threshold 80 "
|
||||
"--query "
|
||||
'\'{"=": {"server_group": "my_group"}}\' '
|
||||
"--resource-type instance "
|
||||
'\'{"=": {"creator": "cr3at0r"}}\' '
|
||||
"--resource-type generic "
|
||||
"--aggregation-method last "
|
||||
"--project-id %s" % PROJECT_ID))
|
||||
alarm = self.details_multiple(result)[0]
|
||||
@ -651,8 +646,8 @@ class AodhClientGnocchiRulesTest(base.ClientTestBase):
|
||||
self.assertEqual('cpu', alarm['metric'])
|
||||
self.assertEqual('80.0', alarm['threshold'])
|
||||
self.assertEqual('last', alarm['aggregation_method'])
|
||||
self.assertEqual('instance', alarm['resource_type'])
|
||||
self.assertEqual('{"=": {"server_group": "my_group"}}',
|
||||
self.assertEqual('generic', alarm['resource_type'])
|
||||
self.assertEqual('{"=": {"creator": "cr3at0r"}}',
|
||||
alarm['query'])
|
||||
|
||||
# CREATE FAIL MISSING PARAM
|
||||
@ -664,8 +659,8 @@ class AodhClientGnocchiRulesTest(base.ClientTestBase):
|
||||
"gnocchi_aggregation_by_resources_threshold "
|
||||
"--name alarm1 --metric cpu "
|
||||
"--query "
|
||||
'\'{"=": {"server_group": "my_group"}}\' '
|
||||
"--resource-type instance "
|
||||
'\'{"=": {"creator": "cr3at0r"}}\' '
|
||||
"--resource-type generic "
|
||||
"--aggregation-method last "
|
||||
"--project-id %s" % PROJECT_ID))
|
||||
|
||||
@ -689,7 +684,7 @@ class AodhClientGnocchiRulesTest(base.ClientTestBase):
|
||||
self.assertEqual('90.0', alarm_show['threshold'])
|
||||
self.assertEqual('critical', alarm_show['severity'])
|
||||
self.assertEqual('last', alarm_show['aggregation_method'])
|
||||
self.assertEqual('instance', alarm_show['resource_type'])
|
||||
self.assertEqual('generic', alarm_show['resource_type'])
|
||||
|
||||
# LIST
|
||||
result = self.aodh('alarm', params="list")
|
||||
|
4
tox.ini
4
tox.ini
@ -16,7 +16,7 @@ deps =
|
||||
.[test]
|
||||
http://tarballs.openstack.org/aodh/aodh-master.tar.gz#egg=aodh[mysql]
|
||||
http://tarballs.openstack.org/gnocchi/gnocchi-master.tar.gz#egg=gnocchi[postgresql,file]
|
||||
commands = pifpaf run aodh --gnocchi-create-legacy-resource-types -- python setup.py test --slowest --testr-args='{posargs}'
|
||||
commands = pifpaf run aodh -- python setup.py test --slowest --testr-args='{posargs}'
|
||||
|
||||
[testenv:pep8]
|
||||
deps = hacking<0.13,>=0.12
|
||||
@ -42,7 +42,7 @@ commands =
|
||||
python setup.py build_sphinx
|
||||
|
||||
[testenv:debug]
|
||||
commands = pifpaf --debug run aodh --gnocchi-create-legacy-resource-types -- oslo_debug_helper {posargs}
|
||||
commands = pifpaf --debug run aodh -- oslo_debug_helper {posargs}
|
||||
|
||||
[flake8]
|
||||
show-source = True
|
||||
|
Loading…
x
Reference in New Issue
Block a user