fix tests
* fix the path to config file * missing test base class * changing keys while iterating on a dict Change-Id: I526ab6c5f4cdd603107b0e89eecd8b01e68a94b9
This commit is contained in:
parent
b2e03404aa
commit
8122f24ebe
@ -34,6 +34,7 @@ from vitrage.datasources import transformer_base as tbase
|
|||||||
from vitrage.datasources.transformer_base import TransformerBase
|
from vitrage.datasources.transformer_base import TransformerBase
|
||||||
from vitrage.tests import base
|
from vitrage.tests import base
|
||||||
from vitrage.tests.mocks import mock_driver as mock_sync
|
from vitrage.tests.mocks import mock_driver as mock_sync
|
||||||
|
from vitrage.tests.mocks import utils
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -46,8 +47,8 @@ class KubernetesTransformerTest(base.BaseTest):
|
|||||||
cfg.StrOpt(DSOpts.UPDATE_METHOD,
|
cfg.StrOpt(DSOpts.UPDATE_METHOD,
|
||||||
default=UpdateMethod.PULL),
|
default=UpdateMethod.PULL),
|
||||||
cfg.StrOpt(DSOpts.CONFIG_FILE,
|
cfg.StrOpt(DSOpts.CONFIG_FILE,
|
||||||
default='/opt/stack/vitrage/vitrage/tests/resources/'
|
default=utils.get_resources_dir() +
|
||||||
'kubernetes/kubernetes_config.yaml'),
|
'/kubernetes/kubernetes_config.yaml'),
|
||||||
]
|
]
|
||||||
|
|
||||||
# noinspection PyAttributeOutsideInit,PyPep8Naming
|
# noinspection PyAttributeOutsideInit,PyPep8Naming
|
||||||
@ -55,13 +56,15 @@ class KubernetesTransformerTest(base.BaseTest):
|
|||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
super(KubernetesTransformerTest, cls).setUpClass()
|
super(KubernetesTransformerTest, cls).setUpClass()
|
||||||
cls.transformers = {}
|
cls.transformers = {}
|
||||||
cls.conf = cfg.ConfigOpts()
|
|
||||||
cls.conf.register_opts(cls.OPTS, group=KUBERNETES_DATASOURCE)
|
|
||||||
cls.transformers[KUBERNETES_DATASOURCE] = KubernetesTransformer(
|
cls.transformers[KUBERNETES_DATASOURCE] = KubernetesTransformer(
|
||||||
cls.transformers)
|
cls.transformers)
|
||||||
cls.transformers[NOVA_INSTANCE_DATASOURCE] = \
|
cls.transformers[NOVA_INSTANCE_DATASOURCE] = \
|
||||||
InstanceTransformer(cls.transformers)
|
InstanceTransformer(cls.transformers)
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super(KubernetesTransformerTest, self).setUp()
|
||||||
|
self.conf_reregister_opts(self.OPTS, group=KUBERNETES_DATASOURCE)
|
||||||
|
|
||||||
def test_snapshot_event_transform(self):
|
def test_snapshot_event_transform(self):
|
||||||
LOG.debug('Test tactual transform action for '
|
LOG.debug('Test tactual transform action for '
|
||||||
'snapshot and snapshot init events')
|
'snapshot and snapshot init events')
|
||||||
|
@ -74,7 +74,7 @@ class TemplateLoaderTest(base.BaseTest):
|
|||||||
|
|
||||||
# Assertions
|
# Assertions
|
||||||
for definition in definitions[TFields.ENTITIES]:
|
for definition in definitions[TFields.ENTITIES]:
|
||||||
for key, value in definition['entity'].items():
|
for key, value in list(definition['entity'].items()):
|
||||||
new_key = PropsConverter.PROPS_CONVERSION[key] \
|
new_key = PropsConverter.PROPS_CONVERSION[key] \
|
||||||
if key in PropsConverter.PROPS_CONVERSION else key
|
if key in PropsConverter.PROPS_CONVERSION else key
|
||||||
del definition['entity'][key]
|
del definition['entity'][key]
|
||||||
@ -173,7 +173,7 @@ class TemplateLoaderTest(base.BaseTest):
|
|||||||
|
|
||||||
# Assertions
|
# Assertions
|
||||||
for definition in definitions[TFields.ENTITIES]:
|
for definition in definitions[TFields.ENTITIES]:
|
||||||
for key, value in definition['entity'].items():
|
for key, value in list(definition['entity'].items()):
|
||||||
new_key = PropsConverter.PROPS_CONVERSION[key] \
|
new_key = PropsConverter.PROPS_CONVERSION[key] \
|
||||||
if key in PropsConverter.PROPS_CONVERSION else key
|
if key in PropsConverter.PROPS_CONVERSION else key
|
||||||
del definition['entity'][key]
|
del definition['entity'][key]
|
||||||
|
@ -22,6 +22,7 @@ from pysnmp.proto.rfc1902 import TimeTicks
|
|||||||
|
|
||||||
from vitrage.snmp_parsing.service import SnmpParsingService
|
from vitrage.snmp_parsing.service import SnmpParsingService
|
||||||
from vitrage.tests import base
|
from vitrage.tests import base
|
||||||
|
from vitrage.tests.mocks import utils
|
||||||
|
|
||||||
|
|
||||||
BINDS_REPORTED = [
|
BINDS_REPORTED = [
|
||||||
@ -112,8 +113,8 @@ class TestSnmpParsing(base.BaseTest):
|
|||||||
super(TestSnmpParsing, self).setUp()
|
super(TestSnmpParsing, self).setUp()
|
||||||
self.cfg_fixture.config(
|
self.cfg_fixture.config(
|
||||||
group='snmp_parsing',
|
group='snmp_parsing',
|
||||||
oid_mapping='vitrage/tests/resources/snmp_parsing/'
|
oid_mapping=utils.get_resources_dir() +
|
||||||
'snmp_parsing_conf.yaml')
|
'/snmp_parsing/snmp_parsing_conf.yaml')
|
||||||
|
|
||||||
def test_convert_binds_to_dict(self):
|
def test_convert_binds_to_dict(self):
|
||||||
parsing_service = SnmpParsingService(1)
|
parsing_service = SnmpParsingService(1)
|
||||||
|
@ -93,7 +93,8 @@ class MigrationCheckersMixin(object):
|
|||||||
|
|
||||||
class TestMigrationsMySQL(MigrationCheckersMixin,
|
class TestMigrationsMySQL(MigrationCheckersMixin,
|
||||||
WalkWersionsMixin,
|
WalkWersionsMixin,
|
||||||
test_fixtures.OpportunisticDBTestMixin):
|
test_fixtures.OpportunisticDBTestMixin,
|
||||||
|
test_base.BaseTestCase):
|
||||||
FIXTURE = test_fixtures.MySQLOpportunisticFixture
|
FIXTURE = test_fixtures.MySQLOpportunisticFixture
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user