Merge "remove tests using template dir /etc/vitrage/templates"
This commit is contained in:
commit
0a6d3af701
@ -21,7 +21,6 @@ from vitrage_tempest_plugin.tests.base import BaseVitrageTempest
|
||||
from vitrage_tempest_plugin.tests.base import IsNotEmpty
|
||||
from vitrage_tempest_plugin.tests.common import general_utils as g_utils
|
||||
from vitrage_tempest_plugin.tests.common import vitrage_utils
|
||||
from vitrage_tempest_plugin.tests import utils
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -30,7 +29,6 @@ LOG = logging.getLogger(__name__)
|
||||
class BaseTemplateTest(BaseVitrageTempest):
|
||||
"""Template test class for Vitrage API tests."""
|
||||
|
||||
DEFAULT_PATH = '/etc/vitrage/templates/'
|
||||
TEST_PATH = '/opt/stack/vitrage/vitrage_tempest_plugin/' \
|
||||
+ 'tests/resources/templates/api/'
|
||||
|
||||
@ -66,7 +64,6 @@ class BaseTemplateTest(BaseVitrageTempest):
|
||||
self._validate_templates_list_length(api_templates, cli_templates)
|
||||
self._validate_passed_templates_length(api_templates, cli_templates)
|
||||
self._compare_each_template_in_list(api_templates, cli_templates)
|
||||
self._validate_templates_existence_in_default_folder(api_templates)
|
||||
|
||||
def _compare_template_validations(self, api_templates, cli_templates):
|
||||
self.assertThat(api_templates, IsNotEmpty(),
|
||||
@ -107,15 +104,6 @@ class BaseTemplateTest(BaseVitrageTempest):
|
||||
break
|
||||
self.assertThat(api_templates, matchers.HasLength(counter))
|
||||
|
||||
def _validate_templates_existence_in_default_folder(self, templates_list):
|
||||
counter = 0
|
||||
text_out = utils.get_from_terminal('ls ' + self.DEFAULT_PATH)
|
||||
for item in templates_list:
|
||||
name_start = text_out.count(' ' + item['name'] + ' ')
|
||||
if name_start > -1:
|
||||
counter += 1
|
||||
self.assertThat(templates_list, matchers.HasLength(counter))
|
||||
|
||||
def _run_default_template_validation(
|
||||
self, template, validation, path):
|
||||
self.assertThat(validation, IsNotEmpty(),
|
||||
@ -156,24 +144,6 @@ class BaseTemplateTest(BaseVitrageTempest):
|
||||
sorted_api_templates = sorted(api_templates.items())
|
||||
self.assertEqual(sorted_api_templates, sorted_cli_templates)
|
||||
|
||||
def _validate_template_structure(self, template_item, template_show):
|
||||
self.assertEqual(
|
||||
template_item['name'], template_show['metadata']['name'])
|
||||
template_content = utils.get_from_terminal(
|
||||
'cat ' + self.DEFAULT_PATH + template_item['name'] + '*')
|
||||
|
||||
entities = template_content.count('entity:')
|
||||
relationships = template_content.count('relationship:')
|
||||
scenarios = template_content.count('scenario:')
|
||||
|
||||
self.assertIn(template_show['metadata']['name'], template_content)
|
||||
self.assertThat(template_show['definitions']['entities'],
|
||||
matchers.HasLength(entities))
|
||||
self.assertThat(template_show['definitions']['relationships'],
|
||||
matchers.HasLength(relationships))
|
||||
self.assertThat(template_show['scenarios'],
|
||||
matchers.HasLength(scenarios))
|
||||
|
||||
def _rollback_to_default(self, templates):
|
||||
try:
|
||||
for t in templates:
|
||||
|
@ -12,7 +12,6 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import unittest
|
||||
|
||||
from oslo_log import log as logging
|
||||
from testtools import matchers
|
||||
@ -70,35 +69,6 @@ class TestValidate(BaseTemplateTest):
|
||||
|
||||
self._compare_template_lists(api_template_list, cli_template_list)
|
||||
|
||||
def test_compare_templates_validation(self):
|
||||
"""template_validate test
|
||||
|
||||
There test validate correctness of template validation,
|
||||
equals templates files validation between cli via api
|
||||
"""
|
||||
path = self.DEFAULT_PATH
|
||||
api_template_validation = \
|
||||
self.vitrage_client.template.validate(path=path)
|
||||
cli_template_validation = utils.run_vitrage_command(
|
||||
'vitrage template validate --path ' + path, self.conf)
|
||||
|
||||
self._compare_template_validations(
|
||||
api_template_validation, cli_template_validation)
|
||||
|
||||
@unittest.skip("skipping test")
|
||||
# TODO(nivo): fix test - passes on machine but not at gate
|
||||
def test_templates_validate_default_templates(self):
|
||||
"""templates_validate test
|
||||
|
||||
There test validate correctness of list of uploaded template files
|
||||
(in /etc/vitrage/templates folder)
|
||||
"""
|
||||
path = self.DEFAULT_PATH
|
||||
validation = self.vitrage_client.template.validate(path=path)
|
||||
self.assertThat(validation, IsNotEmpty())
|
||||
for item in validation['results']:
|
||||
self._run_template_validation(item, path)
|
||||
|
||||
def test_templates_validate_non_exist_template(self):
|
||||
"""templates_validate test
|
||||
|
||||
@ -142,25 +112,6 @@ class TestValidate(BaseTemplateTest):
|
||||
except Exception:
|
||||
LOG.error('Failed to get validation of template file')
|
||||
|
||||
@unittest.skip("CLI tests are ineffective and not maintained")
|
||||
def test_compare_template_show(self):
|
||||
"""templates_show test
|
||||
|
||||
There test validate correctness of uploaded template files
|
||||
one by one with full details
|
||||
(in /etc/vitrage/templates folder)
|
||||
"""
|
||||
template_list = self.vitrage_client.template.list()
|
||||
self.assertThat(template_list, IsNotEmpty())
|
||||
for item in template_list:
|
||||
api_template_show = self.vitrage_client.template.show(item['uuid'])
|
||||
cli_template_show = utils.run_vitrage_command(
|
||||
'vitrage template show ' + item['uuid'], self.conf)
|
||||
|
||||
self._compare_template_show(
|
||||
api_template_show, cli_template_show)
|
||||
self._validate_template_structure(item, api_template_show)
|
||||
|
||||
|
||||
class TemplatesDBTest(BaseTemplateTest):
|
||||
"""Template DB test class for vitrage API tests"""
|
||||
|
Loading…
x
Reference in New Issue
Block a user