Delete unused code

This patch removes some unused code and empty setUp/tearDown/etc
methods.

It's not required at this point but since I'm refactoring the code let's
make our codebase a bit smaller.

Change-Id: Id12d552e0635479cfa84af7bcb35fbe3529a5c31
This commit is contained in:
Ivan Kolodyazhny 2018-12-22 23:12:33 +02:00
parent 76ef399b9f
commit 7132e33590
39 changed files with 6 additions and 410 deletions

View File

@ -1,15 +0,0 @@
# Copyright 2016 - Nokia
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
__author__ = 'stack'

View File

@ -1,15 +0,0 @@
# Copyright 2016 - Nokia
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
__author__ = 'stack'

View File

@ -1,15 +0,0 @@
# Copyright 2016 - Nokia
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
__author__ = 'stack'

View File

@ -1,15 +0,0 @@
# Copyright 2016 - Nokia
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
__author__ = 'stack'

View File

@ -35,12 +35,6 @@ LOG = logging.getLogger(__name__)
class TestAlarms(BaseAlarmsTest):
"""Alarms test class for Vitrage API tests."""
def setUp(self):
super(TestAlarms, self).setUp()
def tearDown(self):
super(TestAlarms, self).tearDown()
@classmethod
def setUpClass(cls):
super(TestAlarms, cls).setUpClass()

View File

@ -1,15 +0,0 @@
# Copyright 2017 - Nokia
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
__author__ = 'stack'

View File

@ -22,11 +22,6 @@ LOG = logging.getLogger(__name__)
class BaseTestEvents(TestActionsBase):
"""Test class for Vitrage event API"""
# noinspection PyPep8Naming
@classmethod
def setUpClass(cls):
super(BaseTestEvents, cls).setUpClass()
def _check_alarms(self):
api_alarms = self.vitrage_client.alarm.list(vitrage_id='all',
all_tenants=True)

View File

@ -1,15 +0,0 @@
# Copyright 2016 - Nokia
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
__author__ = 'stack'

View File

@ -45,16 +45,6 @@ VITRAGE_ALARM_NAME = 'instance_deduce'
class BaseRcaTest(BaseAlarmsTest):
def setUp(self):
super(BaseRcaTest, self).setUp()
def tearDown(self):
super(BaseRcaTest, self).tearDown()
@classmethod
def setUpClass(cls):
super(BaseRcaTest, cls).setUpClass()
def _clean_all(self):
nova_utils.delete_all_instances()
aodh_utils.delete_all_aodh_alarms()

View File

@ -32,12 +32,6 @@ LOG = logging.getLogger(__name__)
class TestRca(BaseRcaTest):
"""RCA test class for Vitrage API tests."""
def setUp(self):
super(TestRca, self).setUp()
def tearDown(self):
super(TestRca, self).tearDown()
@classmethod
def setUpClass(cls):
super(TestRca, cls).setUpClass()

View File

@ -43,16 +43,6 @@ class TestResource(BaseVitrageTempest):
VProps.STATE,
VProps.VITRAGE_AGGREGATED_STATE)
def setUp(self):
super(TestResource, self).setUp()
def tearDown(self):
super(TestResource, self).tearDown()
@classmethod
def setUpClass(cls):
super(TestResource, cls).setUpClass()
@utils.tempest_logger
def test_compare_cli_vs_api_resource_list(self):
"""resource list """

View File

@ -1,15 +0,0 @@
# Copyright 2016 - Nokia
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
__author__ = 'stack'

View File

@ -40,16 +40,6 @@ class BaseTemplateTest(BaseVitrageTempest):
OK_STATUS = 'validation OK'
OK_MSG = 'Template validation is OK'
def setUp(self):
super(BaseTemplateTest, self).setUp()
def tearDown(self):
super(BaseTemplateTest, self).tearDown()
@classmethod
def setUpClass(cls):
super(BaseTemplateTest, cls).setUpClass()
def _compare_template_lists(self, api_templates, cli_templates):
self.assertThat(api_templates, IsNotEmpty(),
'The template list taken from api is empty')

View File

@ -42,12 +42,6 @@ FAKE_UUID = 'ade68276-0fe9-42cd-9ec2-e7f20470a771'
class TestValidate(BaseTemplateTest):
"""Template test class for Vitrage API tests."""
def setUp(self):
super(TestValidate, self).setUp()
def tearDown(self):
super(TestValidate, self).tearDown()
@classmethod
def setUpClass(cls):
super(TestValidate, cls).setUpClass()

View File

@ -30,10 +30,6 @@ FAKE_UUID = 'ade68276-0fe9-42cd-9ec2-e7f20470a771'
class TestValidateV2(BaseTemplateTest):
"""Template test class for Vitrage API tests."""
@classmethod
def setUpClass(cls):
super(TestValidateV2, cls).setUpClass()
def test_templates_validate_no_type_templates(self):
try:
path = self.TEST_PATH + NO_TYPE_TEMPLATE

View File

@ -1,15 +0,0 @@
# Copyright 2016 - Nokia
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
__author__ = 'stack'

View File

@ -28,16 +28,6 @@ from vitrage_tempest_plugin.tests.common import nova_utils
class BaseTopologyTest(BaseVitrageTempest):
"""Topology test class for Vitrage API tests."""
def setUp(self):
super(BaseTopologyTest, self).setUp()
def tearDown(self):
super(BaseTopologyTest, self).tearDown()
@classmethod
def setUpClass(cls):
super(BaseTopologyTest, cls).setUpClass()
def _rollback_to_default(self):
self._delete_entities()
api_graph = self.vitrage_client.topology.get(

View File

@ -42,16 +42,6 @@ class TestTopology(BaseTopologyTest):
NUM_INSTANCE = 3
NUM_VOLUME = 1
def setUp(self):
super(TestTopology, self).setUp()
def tearDown(self):
super(TestTopology, self).tearDown()
@classmethod
def setUpClass(cls):
super(TestTopology, cls).setUpClass()
def _get_root_vertex_id(self):
items = self.vitrage_client.resource.list(
resource_type=OPENSTACK_CLUSTER, all_tenants=True)

View File

@ -1,15 +0,0 @@
# Copyright 2017 - Nokia
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
__author__ = 'stack'

View File

@ -14,11 +14,9 @@
from datetime import datetime
import json
from networkx.readwrite import json_graph
import six
import sys
import traceback
from networkx.readwrite import json_graph
from oslo_log import log as logging
from oslo_utils import timeutils
from oslotest import base
@ -76,18 +74,10 @@ class BaseVitrageTempest(base.BaseTestCase):
ADMIN_PROJECT_NAME = 'admin'
def assert_list_equal(self, l1, l2):
if tuple(sys.version_info)[0:2] < (2, 7):
# for python 2.6 compatibility
self.assertEqual(l1, l2)
else:
super(BaseVitrageTempest, self).assertListEqual(l1, l2)
self.assertListEqual(l1, l2)
def assert_dict_equal(self, d1, d2, message):
if tuple(sys.version_info)[0:2] < (2, 7):
# for python 2.6 compatibility
self.assertEqual(d1, d2)
else:
super(BaseVitrageTempest, self).assertDictEqual(d1, d2, message)
self.assertDictEqual(d1, d2, message)
def assert_timestamp_equal(self, first, second, msg=None):
"""Checks that two timestamps are equals.
@ -353,7 +343,6 @@ class BaseVitrageTempest(base.BaseTestCase):
LOG.info('Entity Graph: \n%s', json.dumps(node_link_data))
def _handle_exception(self, exception):
traceback.print_exc()
LOG.exception(exception)
self._print_entity_graph()

View File

@ -1,15 +0,0 @@
# Copyright 2017 - Nokia
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
__author__ = 'stack'

View File

@ -13,6 +13,7 @@
# under the License.
import random
import time
from vitrage_tempest_plugin.tests.common.tempest_clients import TempestClients

View File

@ -51,13 +51,8 @@ def generate_fake_host_alarm(hostname, event_type, enabled=True):
def get_first_host(**kwargs):
try:
hosts = TempestClients.vitrage().resource.list(
NOVA_HOST_DATASOURCE, all_tenants=True)
except Exception as e:
LOG.exception("get_first_host failed with %s", e)
hosts = TempestClients.vitrage().resource.list(
NOVA_HOST_DATASOURCE, all_tenants=True)
hosts = TempestClients.vitrage().resource.list(
NOVA_HOST_DATASOURCE, all_tenants=True)
return g_utils.first_match(hosts, **kwargs)

View File

@ -1,15 +0,0 @@
# Copyright 2016 - Nokia
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
__author__ = 'stack'

View File

@ -27,16 +27,6 @@ class TestAodhAlarm(BaseAlarmsTest):
NUM_INSTANCE = 1
NUM_ALARM = 1
def setUp(self):
super(TestAodhAlarm, self).setUp()
def tearDown(self):
super(TestAodhAlarm, self).tearDown()
@classmethod
def setUpClass(cls):
super(TestAodhAlarm, cls).setUpClass()
@utils.tempest_logger
def test_alarm_with_resource_id(self):
try:

View File

@ -23,16 +23,6 @@ class TestCinderVolume(BaseTopologyTest):
NUM_INSTANCE = 3
NUM_VOLUME = 1
def setUp(self):
super(TestCinderVolume, self).setUp()
def tearDown(self):
super(TestCinderVolume, self).tearDown()
@classmethod
def setUpClass(cls):
super(TestCinderVolume, cls).setUpClass()
@utils.tempest_logger
def test_volume(self):
try:

View File

@ -28,16 +28,6 @@ LOG = logging.getLogger(__name__)
class TestHeatStack(BaseTopologyTest):
NUM_STACKS = 1
def setUp(self):
super(TestHeatStack, self).setUp()
def tearDown(self):
super(TestHeatStack, self).tearDown()
@classmethod
def setUpClass(cls):
super(TestHeatStack, cls).setUpClass()
@utils.tempest_logger
def test_nested_heat_stack(self):
self._test_heat_stack(nested=True,

View File

@ -27,16 +27,6 @@ LOG = logging.getLogger(__name__)
class TestNeutron(BaseTopologyTest):
NUM_INSTANCE = 3
def setUp(self):
super(TestNeutron, self).setUp()
def tearDown(self):
super(TestNeutron, self).tearDown()
@classmethod
def setUpClass(cls):
super(TestNeutron, cls).setUpClass()
@utils.tempest_logger
def test_neutron(self):
"""neutron test

View File

@ -22,16 +22,6 @@ LOG = logging.getLogger(__name__)
class TestNova(BaseTopologyTest):
NUM_INSTANCE = 3
def setUp(self):
super(TestNova, self).setUp()
def tearDown(self):
super(TestNova, self).tearDown()
@classmethod
def setUpClass(cls):
super(TestNova, cls).setUpClass()
@utils.tempest_logger
def test_nova_entities(self):
try:

View File

@ -29,16 +29,6 @@ class TestStatic(BaseVitrageTempest):
NUM_SWITCH = 1
NUM_NIC = 1
def setUp(self):
super(TestStatic, self).setUp()
def tearDown(self):
super(TestStatic, self).tearDown()
@classmethod
def setUpClass(cls):
super(TestStatic, cls).setUpClass()
@utils.tempest_logger
def test_switches(self):
try:

View File

@ -1,15 +0,0 @@
# Copyright 2017 - Nokia
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
__author__ = 'stack'

View File

@ -27,12 +27,6 @@ LOG = logging.getLogger(__name__)
class TestActionsBase(BaseVitrageTempest):
def setUp(self):
super(TestActionsBase, self).setUp()
def tearDown(self):
super(TestActionsBase, self).tearDown()
@classmethod
def setUpClass(cls):
super(TestActionsBase, cls).setUpClass()

View File

@ -55,12 +55,6 @@ class TestBasicActions(TestActionsBase):
super(TestBasicActions, cls).setUpClass()
cls._template = v_utils.add_template("e2e_test_basic_actions.yaml")
def setUp(self):
super(TestBasicActions, self).setUp()
def tearDown(self):
super(TestBasicActions, self).tearDown()
@classmethod
def tearDownClass(cls):
if cls._template is not None:

View File

@ -58,9 +58,6 @@ class TestTemplateActions(TestActionsBase):
super(TestTemplateActions, self).__init__(*args, **kwds)
self.added_template = None
def setUp(self):
super(TestTemplateActions, self).setUp()
def tearDown(self):
super(TestTemplateActions, self).tearDown()
time.sleep(10)

View File

@ -88,9 +88,6 @@ class TestWebhook(TestActionsBase):
if cls._template is not None:
v_utils.delete_template(cls._template['uuid'])
def setUp(self):
super(TestWebhook, self).setUp()
def tearDown(self):
super(TestWebhook, self).tearDown()
del messages[:]

View File

@ -62,12 +62,6 @@ class TestOverlappingActions(TestActionsBase):
cls._template = v_utils.add_template(
'e2e_test_overlapping_actions.yaml')
def setUp(self):
super(TestOverlappingActions, self).setUp()
def tearDown(self):
super(TestOverlappingActions, self).tearDown()
@classmethod
def tearDownClass(cls):
if cls._template is not None:

View File

@ -1,15 +0,0 @@
# Copyright 2017 - Nokia
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
__author__ = 'stack'

View File

@ -49,12 +49,6 @@ class TestMistralNotifier(BaseTestEvents):
TRIGGER_ALARM_2 = "notifiers.mistral.trigger.alarm.2"
TRIGGER_ALARM_FOR_FUNCTION = "notifiers.mistral.trigger.alarm.for.function"
def setUp(self):
super(TestMistralNotifier, self).setUp()
def tearDown(self):
super(TestMistralNotifier, self).tearDown()
@classmethod
def setUpClass(cls):
super(TestMistralNotifier, cls).setUpClass()

View File

@ -21,7 +21,6 @@ from oslo_config.cfg import NoSuchOptError
from oslo_log import log as logging
import os
import re
import subprocess
LOG = logging.getLogger(__name__)
@ -29,13 +28,6 @@ LOG = logging.getLogger(__name__)
TIMESTAMP_FORMAT = '%Y-%m-%dT%H:%M:%SZ'
def get_from_terminal(command):
proc = os.popen(command)
text_out = proc.read()
proc.close()
return text_out
def run_vitrage_command(command, conf):
# AUTH_URL
local_ip = '127.0.0.1'
@ -118,25 +110,6 @@ def get_property_value(environment_name, conf_name, default_value, conf):
return default_value
def run_from_terminal(command):
proc = os.popen(command)
proc.close()
def change_terminal_dir(path):
os.chdir(path)
LOG.debug("The path is : " + path)
def get_regex_result(pattern, text):
p = re.compile(pattern)
m = p.search(text)
if m:
LOG.debug("The regex value is " + m.group(1))
return m.group(1)
return None
def uni2str(text):
return text.encode('ascii', 'ignore')