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.tests import base
|
||||
from vitrage.tests.mocks import mock_driver as mock_sync
|
||||
from vitrage.tests.mocks import utils
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@ -46,8 +47,8 @@ class KubernetesTransformerTest(base.BaseTest):
|
||||
cfg.StrOpt(DSOpts.UPDATE_METHOD,
|
||||
default=UpdateMethod.PULL),
|
||||
cfg.StrOpt(DSOpts.CONFIG_FILE,
|
||||
default='/opt/stack/vitrage/vitrage/tests/resources/'
|
||||
'kubernetes/kubernetes_config.yaml'),
|
||||
default=utils.get_resources_dir() +
|
||||
'/kubernetes/kubernetes_config.yaml'),
|
||||
]
|
||||
|
||||
# noinspection PyAttributeOutsideInit,PyPep8Naming
|
||||
@ -55,13 +56,15 @@ class KubernetesTransformerTest(base.BaseTest):
|
||||
def setUpClass(cls):
|
||||
super(KubernetesTransformerTest, cls).setUpClass()
|
||||
cls.transformers = {}
|
||||
cls.conf = cfg.ConfigOpts()
|
||||
cls.conf.register_opts(cls.OPTS, group=KUBERNETES_DATASOURCE)
|
||||
cls.transformers[KUBERNETES_DATASOURCE] = KubernetesTransformer(
|
||||
cls.transformers)
|
||||
cls.transformers[NOVA_INSTANCE_DATASOURCE] = \
|
||||
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):
|
||||
LOG.debug('Test tactual transform action for '
|
||||
'snapshot and snapshot init events')
|
||||
|
@ -74,7 +74,7 @@ class TemplateLoaderTest(base.BaseTest):
|
||||
|
||||
# Assertions
|
||||
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] \
|
||||
if key in PropsConverter.PROPS_CONVERSION else key
|
||||
del definition['entity'][key]
|
||||
@ -173,7 +173,7 @@ class TemplateLoaderTest(base.BaseTest):
|
||||
|
||||
# Assertions
|
||||
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] \
|
||||
if key in PropsConverter.PROPS_CONVERSION else key
|
||||
del definition['entity'][key]
|
||||
|
@ -22,6 +22,7 @@ from pysnmp.proto.rfc1902 import TimeTicks
|
||||
|
||||
from vitrage.snmp_parsing.service import SnmpParsingService
|
||||
from vitrage.tests import base
|
||||
from vitrage.tests.mocks import utils
|
||||
|
||||
|
||||
BINDS_REPORTED = [
|
||||
@ -112,8 +113,8 @@ class TestSnmpParsing(base.BaseTest):
|
||||
super(TestSnmpParsing, self).setUp()
|
||||
self.cfg_fixture.config(
|
||||
group='snmp_parsing',
|
||||
oid_mapping='vitrage/tests/resources/snmp_parsing/'
|
||||
'snmp_parsing_conf.yaml')
|
||||
oid_mapping=utils.get_resources_dir() +
|
||||
'/snmp_parsing/snmp_parsing_conf.yaml')
|
||||
|
||||
def test_convert_binds_to_dict(self):
|
||||
parsing_service = SnmpParsingService(1)
|
||||
|
@ -93,7 +93,8 @@ class MigrationCheckersMixin(object):
|
||||
|
||||
class TestMigrationsMySQL(MigrationCheckersMixin,
|
||||
WalkWersionsMixin,
|
||||
test_fixtures.OpportunisticDBTestMixin):
|
||||
test_fixtures.OpportunisticDBTestMixin,
|
||||
test_base.BaseTestCase):
|
||||
FIXTURE = test_fixtures.MySQLOpportunisticFixture
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user