Merge "Remove unicode from tests"
This commit is contained in:
commit
9ab0c623ba
@ -16,13 +16,13 @@
|
|||||||
|
|
||||||
from vitrage.tests.functional import api
|
from vitrage.tests.functional import api
|
||||||
|
|
||||||
|
VERSIONS_RESPONSE = {'versions': [
|
||||||
VERSIONS_RESPONSE = {u'versions': [{u'id': u'v1.0',
|
{'id': 'v1.0',
|
||||||
u'links': [
|
'links': [
|
||||||
{u'href': u'http://localhost/v1/',
|
{'href': 'http://localhost/v1/',
|
||||||
u'rel': u'self'}],
|
'rel': 'self'}],
|
||||||
u'status': u'CURRENT',
|
'status': 'CURRENT',
|
||||||
u'updated': u'2015-11-29'}]}
|
'updated': '2015-11-29'}]}
|
||||||
|
|
||||||
|
|
||||||
class TestVersions(api.FunctionalTest):
|
class TestVersions(api.FunctionalTest):
|
||||||
|
@ -21,16 +21,16 @@ from vitrage.tests.functional.api.v1 import FunctionalTest
|
|||||||
|
|
||||||
VERSIONS = [
|
VERSIONS = [
|
||||||
{
|
{
|
||||||
u'version': u'v1',
|
'version': 'v1',
|
||||||
u'status': u'SUPPORTED'
|
'status': 'SUPPORTED'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
u'version': u'v2',
|
'version': 'v2',
|
||||||
u'status': u'SUPPORTED'
|
'status': 'SUPPORTED'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
u'version': u'v3',
|
'version': 'v3',
|
||||||
u'status': 'CURRENT'
|
'status': 'CURRENT'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ class NagiosParserTest(NagiosBaseTest):
|
|||||||
NagiosProperties.DURATION: ' 8d 2h 16m 33s',
|
NagiosProperties.DURATION: ' 8d 2h 16m 33s',
|
||||||
NagiosProperties.ATTEMPT: '1/1',
|
NagiosProperties.ATTEMPT: '1/1',
|
||||||
NagiosProperties.STATUS_INFO:
|
NagiosProperties.STATUS_INFO:
|
||||||
u'high CPU load\xa0'}
|
'high CPU load\xa0'}
|
||||||
|
|
||||||
expected_service2 = {NagiosProperties.RESOURCE_NAME: 'compute-0-1.local',
|
expected_service2 = {NagiosProperties.RESOURCE_NAME: 'compute-0-1.local',
|
||||||
NagiosProperties.SERVICE: 'check_load',
|
NagiosProperties.SERVICE: 'check_load',
|
||||||
@ -38,7 +38,7 @@ class NagiosParserTest(NagiosBaseTest):
|
|||||||
NagiosProperties.DURATION: ' 1d 0h 54m 59s',
|
NagiosProperties.DURATION: ' 1d 0h 54m 59s',
|
||||||
NagiosProperties.ATTEMPT: '1/1',
|
NagiosProperties.ATTEMPT: '1/1',
|
||||||
NagiosProperties.STATUS_INFO:
|
NagiosProperties.STATUS_INFO:
|
||||||
u'Critical Error\xa0'}
|
'Critical Error\xa0'}
|
||||||
|
|
||||||
expected_service3 = {NagiosProperties.RESOURCE_NAME: 'compute-0-0.local',
|
expected_service3 = {NagiosProperties.RESOURCE_NAME: 'compute-0-0.local',
|
||||||
NagiosProperties.SERVICE: 'Disk IO SUMMARY',
|
NagiosProperties.SERVICE: 'Disk IO SUMMARY',
|
||||||
@ -47,8 +47,8 @@ class NagiosParserTest(NagiosBaseTest):
|
|||||||
NagiosProperties.DURATION: '14d 1h 28m 34s',
|
NagiosProperties.DURATION: '14d 1h 28m 34s',
|
||||||
NagiosProperties.ATTEMPT: '1/1',
|
NagiosProperties.ATTEMPT: '1/1',
|
||||||
NagiosProperties.STATUS_INFO:
|
NagiosProperties.STATUS_INFO:
|
||||||
u'OK - 0.00 B/sec read, 1.84 MB/sec write, '
|
'OK - 0.00 B/sec read, 1.84 MB/sec write, '
|
||||||
u'IOs: 89.00/sec\xa0'}
|
'IOs: 89.00/sec\xa0'}
|
||||||
|
|
||||||
# noinspection PyPep8Naming
|
# noinspection PyPep8Naming
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -89,7 +89,7 @@ class PrometheusDriverTest(base.BaseTest):
|
|||||||
driver._calculate_vitrage_entity_unique_props(host_alert_2)
|
driver._calculate_vitrage_entity_unique_props(host_alert_2)
|
||||||
|
|
||||||
# Test assertion
|
# Test assertion
|
||||||
expected = {u'id': hostname}
|
expected = {'id': hostname}
|
||||||
self.assertEqual(expected, observed_host_alert_1)
|
self.assertEqual(expected, observed_host_alert_1)
|
||||||
self.assertEqual(expected, observed_host_alert_2)
|
self.assertEqual(expected, observed_host_alert_2)
|
||||||
|
|
||||||
@ -113,8 +113,8 @@ class PrometheusDriverTest(base.BaseTest):
|
|||||||
driver._calculate_vitrage_entity_unique_props(vm_alert_2)
|
driver._calculate_vitrage_entity_unique_props(vm_alert_2)
|
||||||
|
|
||||||
# Test assertion
|
# Test assertion
|
||||||
expected = {u'instance_name': 'instance-00000005',
|
expected = {'instance_name': 'instance-00000005',
|
||||||
u'host_id': hostname}
|
'host_id': hostname}
|
||||||
self.assertEqual(expected, observed_vm_alert_1)
|
self.assertEqual(expected, observed_vm_alert_1)
|
||||||
self.assertEqual(expected, observed_vm_alert_2)
|
self.assertEqual(expected, observed_vm_alert_2)
|
||||||
|
|
||||||
@ -131,9 +131,9 @@ class PrometheusDriverTest(base.BaseTest):
|
|||||||
observed_alert_2 = driver._get_resource_alert_values(alert_2)
|
observed_alert_2 = driver._get_resource_alert_values(alert_2)
|
||||||
|
|
||||||
# Test assertions
|
# Test assertions
|
||||||
expected_alert_1 = {u'instance': '135.248.18.109:9100'}
|
expected_alert_1 = {'instance': '135.248.18.109:9100'}
|
||||||
expected_alert_2 = {u'instance': '135.248.18.109:9177',
|
expected_alert_2 = {'instance': '135.248.18.109:9177',
|
||||||
u'domain': 'instance-00000005'}
|
'domain': 'instance-00000005'}
|
||||||
self.assertEqual(expected_alert_1, observed_alert_1)
|
self.assertEqual(expected_alert_1, observed_alert_1)
|
||||||
self.assertEqual(expected_alert_2, observed_alert_2)
|
self.assertEqual(expected_alert_2, observed_alert_2)
|
||||||
|
|
||||||
@ -150,9 +150,9 @@ class PrometheusDriverTest(base.BaseTest):
|
|||||||
observed_alert_2 = driver._get_conf_resource(alert_2)
|
observed_alert_2 = driver._get_conf_resource(alert_2)
|
||||||
|
|
||||||
# Test assertions
|
# Test assertions
|
||||||
expected_alert_1 = {u'id': u'instance'}
|
expected_alert_1 = {'id': 'instance'}
|
||||||
expected_alert_2 = {u'instance_name': u'domain',
|
expected_alert_2 = {'instance_name': 'domain',
|
||||||
u'host_id': u'instance'}
|
'host_id': 'instance'}
|
||||||
self.assertEqual(expected_alert_1, observed_alert_1)
|
self.assertEqual(expected_alert_1, observed_alert_1)
|
||||||
self.assertEqual(expected_alert_2, observed_alert_2)
|
self.assertEqual(expected_alert_2, observed_alert_2)
|
||||||
|
|
||||||
|
@ -71,40 +71,40 @@ BINDS_REPORTED = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
DICT_EXPECTED = {
|
DICT_EXPECTED = {
|
||||||
u'1.3.6.1.4.1.3902.4101.1.3.1.8':
|
'1.3.6.1.4.1.3902.4101.1.3.1.8':
|
||||||
u'vimid=,hid=controller_controller,'
|
'vimid=,hid=controller_controller,'
|
||||||
u'hostname=controller,'
|
'hostname=controller,'
|
||||||
u'Reason: nova-compute is not available',
|
'Reason: nova-compute is not available',
|
||||||
u'1.3.6.1.4.1.3902.4101.1.3.1.9': 1581,
|
'1.3.6.1.4.1.3902.4101.1.3.1.9': 1581,
|
||||||
u'1.3.6.1.4.1.3902.4101.1.3.1.6': 0,
|
'1.3.6.1.4.1.3902.4101.1.3.1.6': 0,
|
||||||
u'1.3.6.1.4.1.3902.4101.1.3.1.7': u'',
|
'1.3.6.1.4.1.3902.4101.1.3.1.7': '',
|
||||||
u'1.3.6.1.4.1.3902.4101.1.3.1.4': 1,
|
'1.3.6.1.4.1.3902.4101.1.3.1.4': 1,
|
||||||
u'1.3.6.1.4.1.3902.4101.1.3.1.5': 14,
|
'1.3.6.1.4.1.3902.4101.1.3.1.5': 14,
|
||||||
u'1.3.6.1.4.1.3902.4101.1.3.1.2': u'host',
|
'1.3.6.1.4.1.3902.4101.1.3.1.2': 'host',
|
||||||
u'1.3.6.1.4.1.3902.4101.1.3.1.3':
|
'1.3.6.1.4.1.3902.4101.1.3.1.3':
|
||||||
u'\x07\xe1\x04\x06\x07\x04\x08\x00+\x08\x00',
|
'\x07\xe1\x04\x06\x07\x04\x08\x00+\x08\x00',
|
||||||
u'1.3.6.1.4.1.3902.4101.1.3.1.1': u'3e7393db-2def-447c-8cba-77bf29ab29b4',
|
'1.3.6.1.4.1.3902.4101.1.3.1.1': '3e7393db-2def-447c-8cba-77bf29ab29b4',
|
||||||
u'1.3.6.1.4.1.3902.4101.1.3.1.18': 0,
|
'1.3.6.1.4.1.3902.4101.1.3.1.18': 0,
|
||||||
u'1.3.6.1.4.1.3902.4101.1.3.1.19': u'',
|
'1.3.6.1.4.1.3902.4101.1.3.1.19': '',
|
||||||
u'1.3.6.1.4.1.3902.4101.1.3.1.10': u'',
|
'1.3.6.1.4.1.3902.4101.1.3.1.10': '',
|
||||||
u'1.3.6.1.4.1.3902.4101.1.3.1.11': u'3305115653',
|
'1.3.6.1.4.1.3902.4101.1.3.1.11': '3305115653',
|
||||||
u'1.3.6.1.4.1.3902.4101.1.3.1.12': u'Tecs Director',
|
'1.3.6.1.4.1.3902.4101.1.3.1.12': 'Tecs Director',
|
||||||
u'1.3.6.1.4.1.3902.4101.1.3.1.14': u'compute is not available',
|
'1.3.6.1.4.1.3902.4101.1.3.1.14': 'compute is not available',
|
||||||
u'1.3.6.1.4.1.3902.4101.1.3.1.15': u'vimid=,hostname=controller',
|
'1.3.6.1.4.1.3902.4101.1.3.1.15': 'vimid=,hostname=controller',
|
||||||
u'1.3.6.1.4.1.3902.4101.1.3.1.16': u'',
|
'1.3.6.1.4.1.3902.4101.1.3.1.16': '',
|
||||||
u'1.3.6.1.4.1.3902.4101.1.3.1.17': u'10.62.89.92',
|
'1.3.6.1.4.1.3902.4101.1.3.1.17': '10.62.89.92',
|
||||||
u'1.3.6.1.4.1.3902.4101.1.1.4': 0,
|
'1.3.6.1.4.1.3902.4101.1.1.4': 0,
|
||||||
u'1.3.6.1.4.1.3902.4101.1.1.3': u'',
|
'1.3.6.1.4.1.3902.4101.1.1.3': '',
|
||||||
u'1.3.6.1.4.1.3902.4101.1.1.2': 0,
|
'1.3.6.1.4.1.3902.4101.1.1.2': 0,
|
||||||
u'1.3.6.1.2.1.1.3.0': u'1491462248',
|
'1.3.6.1.2.1.1.3.0': '1491462248',
|
||||||
u'1.3.6.1.6.3.1.1.4.1.0': u'1.3.6.1.4.1.3902.4101.1.4.1.2',
|
'1.3.6.1.6.3.1.1.4.1.0': '1.3.6.1.4.1.3902.4101.1.4.1.2',
|
||||||
u'1.3.6.1.4.1.3902.4101.1.3.1.25': u'',
|
'1.3.6.1.4.1.3902.4101.1.3.1.25': '',
|
||||||
u'1.3.6.1.4.1.3902.4101.1.3.1.24': u'',
|
'1.3.6.1.4.1.3902.4101.1.3.1.24': '',
|
||||||
u'1.3.6.1.4.1.3902.4101.1.3.1.26': u'controller_controller',
|
'1.3.6.1.4.1.3902.4101.1.3.1.26': 'controller_controller',
|
||||||
u'1.3.6.1.4.1.3902.4101.1.3.1.21': 0,
|
'1.3.6.1.4.1.3902.4101.1.3.1.21': 0,
|
||||||
u'1.3.6.1.4.1.3902.4101.1.3.1.20': u'Asia/Harbin',
|
'1.3.6.1.4.1.3902.4101.1.3.1.20': 'Asia/Harbin',
|
||||||
u'1.3.6.1.4.1.3902.4101.1.3.1.23': u'',
|
'1.3.6.1.4.1.3902.4101.1.3.1.23': '',
|
||||||
u'1.3.6.1.4.1.3902.4101.1.3.1.22': 0
|
'1.3.6.1.4.1.3902.4101.1.3.1.22': 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ class TestSnmpParsing(base.BaseTest):
|
|||||||
def test_converted_trap_mapping_diff_system(self):
|
def test_converted_trap_mapping_diff_system(self):
|
||||||
converted_trap_diff_sys = copy.copy(DICT_EXPECTED)
|
converted_trap_diff_sys = copy.copy(DICT_EXPECTED)
|
||||||
converted_trap_diff_sys.update(
|
converted_trap_diff_sys.update(
|
||||||
{u'1.3.6.1.4.1.3902.4101.1.3.1.12': u'Different System'})
|
{'1.3.6.1.4.1.3902.4101.1.3.1.12': 'Different System'})
|
||||||
parsing_service = SnmpParsingService(1)
|
parsing_service = SnmpParsingService(1)
|
||||||
event_type = parsing_service._get_event_type(converted_trap_diff_sys)
|
event_type = parsing_service._get_event_type(converted_trap_diff_sys)
|
||||||
self.assertIsNone(event_type)
|
self.assertIsNone(event_type)
|
||||||
|
Loading…
Reference in New Issue
Block a user