Add new Tempest for datasources in the gate

Change-Id: I627b53634ce09e47d83f1522f4ca74433066fc1c
This commit is contained in:
Alexey Weyl 2016-08-02 15:57:50 +03:00
parent 6a3f023ff1
commit d3f9449733
13 changed files with 14 additions and 80 deletions

View File

@ -61,8 +61,11 @@ notification_topics = notifications,vitrage_notifications
notification_driver = messagingv2
[[post-config|\$VITRAGE_CONF]]
[static_physical]
changes_interval = 5
[datasources]
snapshots_interval = 180
snapshots_interval = 120
EOF
$GATE_DEST/devstack-gate/devstack-vm-gate.sh

View File

@ -30,7 +30,7 @@ fi
(cd $DEVSTACK_PATH/tempest/; sudo oslo-config-generator --config-file etc/config-generator.tempest.conf --output-file etc/tempest.conf)
(cd $DEVSTACK_PATH/; sudo sh -c 'cp -rf vitrage/devstack/files/tempest/tempest.conf /etc/tempest.conf')
(cd $DEVSTACK_PATH/; sudo sh -c 'cp -rf vitrage/vitrage_tempest_tests/tests/resources/static_physical/* /etc/vitrage/static_datasources/')
(cd $DEVSTACK_PATH/; sudo sh -c 'cp -rf vitrage/vitrage_tempest_tests/tests/resources/static_physical/static_physical_configuration.yaml /etc/vitrage/')
(cd $DEVSTACK_PATH/; sudo sh -c 'cp -rf vitrage/vitrage_tempest_tests/tests/resources/templates/api/* /etc/vitrage/templates/')

View File

@ -22,6 +22,7 @@ from novaclient import client as n_client
from vitrage import keystone_client
LOG = log.getLogger(__name__)
OPTS = [

View File

@ -30,7 +30,7 @@ OPTS = [
required=True),
cfg.IntOpt('changes_interval',
default=20,
min=20,
min=5,
help='interval between checking changes in the configuration '
'files of the physical topology data sources',
required=True),

View File

@ -12,9 +12,4 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_config import cfg
OPTS = [
cfg.StrOpt('auth_url',
help='auth_url'),
]
__author__ = 'stack'

View File

@ -33,7 +33,7 @@ from vitrage.graph import Edge
from vitrage.graph import NXGraph
from vitrage.graph import Vertex
from vitrage import keystone_client
from vitrage_tempest_tests.tests import OPTS
from vitrage import service
import vitrage_tempest_tests.tests.utils as utils
from vitrageclient import client as v_client
@ -50,8 +50,7 @@ class BaseApiTest(base.BaseTestCase):
@classmethod
def setUpClass(cls):
super(BaseApiTest, cls).setUpClass()
cls.conf = utils.get_conf()
cls.conf.register_opts(list(OPTS), group='keystone_authtoken')
cls.conf = service.prepare_service([])
cls.vitrage_client = \
v_client.Client('1', session=keystone_client.get_session(cls.conf))
@ -171,8 +170,8 @@ class BaseApiTest(base.BaseTestCase):
len(volume.__dict__['attachments']) == 1
for volume in self.cinder_client.volumes.list())
@staticmethod
def _create_graph_from_graph_dictionary(api_graph):
def _create_graph_from_graph_dictionary(self, api_graph):
self.assertIsNotNone(api_graph)
graph = NXGraph()
nodes = api_graph['nodes']

View File

@ -11,9 +11,9 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from oslo_log import log as logging
from vitrage import clients
from vitrage_tempest_tests.tests.api.alarms.base import BaseAlarmsTest
LOG = logging.getLogger(__name__)
@ -26,7 +26,6 @@ class TestAodhAlarm(BaseAlarmsTest):
@classmethod
def setUpClass(cls):
super(TestAodhAlarm, cls).setUpClass()
cls.ceilometer_client = clients.ceilometer_client(cls.conf)
def test_alarm_with_resource_id(self):
try:
@ -36,7 +35,6 @@ class TestAodhAlarm(BaseAlarmsTest):
# Calculate expected results
api_graph = self.vitrage_client.topology.get()
self.assertIsNotNone(api_graph)
graph = self._create_graph_from_graph_dictionary(api_graph)
entities = self._entities_validation_data(
host_entities=1,
@ -56,8 +54,6 @@ class TestAodhAlarm(BaseAlarmsTest):
num_entities,
num_edges,
entities)
except Exception as e:
LOG.exception(e)
finally:
self._delete_ceilometer_alarms()
self._delete_instances()
@ -69,7 +65,6 @@ class TestAodhAlarm(BaseAlarmsTest):
# Calculate expected results
api_graph = self.vitrage_client.topology.get()
self.assertIsNotNone(api_graph)
graph = self._create_graph_from_graph_dictionary(api_graph)
entities = self._entities_validation_data(
host_entities=1,
@ -85,8 +80,6 @@ class TestAodhAlarm(BaseAlarmsTest):
num_entities,
num_edges,
entities)
except Exception as e:
LOG.exception(e)
finally:
self._delete_ceilometer_alarms()

View File

@ -34,7 +34,6 @@ class TestCinderVolume(BaseTopologyTest):
# Calculate expected results
api_graph = self.vitrage_client.topology.get()
self.assertIsNotNone(api_graph)
graph = self._create_graph_from_graph_dictionary(api_graph)
entities = self._entities_validation_data(
host_entities=1,
@ -54,7 +53,5 @@ class TestCinderVolume(BaseTopologyTest):
num_entities,
num_edges,
entities)
except Exception as e:
LOG.exception(e)
finally:
self._rollback_to_default()

View File

@ -40,7 +40,6 @@ class TestNeutron(BaseTopologyTest):
# Calculate expected results
api_graph = self.vitrage_client.topology.get()
self.assertIsNotNone(api_graph)
graph = self._create_graph_from_graph_dictionary(api_graph)
entities = self._entities_validation_data(
host_entities=1,
@ -62,8 +61,6 @@ class TestNeutron(BaseTopologyTest):
num_entities,
num_edges,
entities)
except Exception as e:
LOG.exception(e)
finally:
self._delete_instances()

View File

@ -32,7 +32,6 @@ class TestNova(BaseTopologyTest):
# Calculate expected results
api_graph = self.vitrage_client.topology.get()
self.assertIsNotNone(api_graph)
graph = self._create_graph_from_graph_dictionary(api_graph)
entities = self._entities_validation_data(
host_entities=1,
@ -50,7 +49,5 @@ class TestNova(BaseTopologyTest):
num_entities,
num_edges,
entities)
except Exception as e:
LOG.exception(e)
finally:
self._rollback_to_default()

View File

@ -37,7 +37,6 @@ class TestStaticPhysical(BaseApiTest):
# Calculate expected results
api_graph = self.vitrage_client.topology.get()
self.assertIsNotNone(api_graph)
graph = self._create_graph_from_graph_dictionary(api_graph)
entities = self._entities_validation_data(
host_entities=1,
@ -54,8 +53,6 @@ class TestStaticPhysical(BaseApiTest):
num_entities,
num_edges,
entities)
except Exception as e:
LOG.exception(e)
finally:
self._delete_switches()
@ -64,9 +61,7 @@ class TestStaticPhysical(BaseApiTest):
hostname = socket.gethostname()
# template file
file_path = '/opt/stack/vitrage/vitrage_tempest_tests/tests/' \
'resources/static_physical/' \
'static_physical_configuration.yaml'
file_path = '/etc/vitrage/static_physical_configuration.yaml'
with open(file_path, 'rb') as f:
template_data = f.read()
template_data = template_data.replace('tmp-devstack', hostname)

View File

@ -61,7 +61,6 @@ class TestTopology(BaseTopologyTest):
# Calculate expected results
api_graph = self.vitrage_client.topology.get()
self.assertIsNotNone(api_graph)
graph = self._create_graph_from_graph_dictionary(api_graph)
entities = self._entities_validation_data(
host_entities=1,
@ -81,8 +80,6 @@ class TestTopology(BaseTopologyTest):
num_entities,
num_edges,
entities)
except Exception as e:
LOG.exception(e)
finally:
self._rollback_to_default()
@ -100,7 +97,6 @@ class TestTopology(BaseTopologyTest):
# Calculate expected results
api_graph = self.vitrage_client.topology.get(
query=self._graph_query())
self.assertIsNotNone(api_graph)
graph = self._create_graph_from_graph_dictionary(api_graph)
entities = self._entities_validation_data(
host_entities=1,
@ -115,8 +111,6 @@ class TestTopology(BaseTopologyTest):
num_entities,
num_edges,
entities)
except Exception as e:
LOG.exception(e)
finally:
self._rollback_to_default()
@ -133,7 +127,6 @@ class TestTopology(BaseTopologyTest):
# Calculate expected results
api_graph = self.vitrage_client.topology.get(
graph_type='tree', query=NOVA_QUERY)
self.assertIsNotNone(api_graph)
graph = self._create_graph_from_tree_dictionary(api_graph)
entities = self._entities_validation_data(
host_entities=1,
@ -148,8 +141,6 @@ class TestTopology(BaseTopologyTest):
num_entities,
num_edges,
entities)
except Exception as e:
LOG.exception(e)
finally:
self._rollback_to_default()
@ -166,7 +157,6 @@ class TestTopology(BaseTopologyTest):
# Calculate expected results
api_graph = self.vitrage_client.topology.get(
graph_type='tree', query=self._tree_query())
self.assertIsNotNone(api_graph)
graph = self._create_graph_from_tree_dictionary(api_graph)
entities = self._entities_validation_data(
host_entities=1, host_edges=1)
@ -176,8 +166,6 @@ class TestTopology(BaseTopologyTest):
self.num_default_entities,
self.num_default_edges,
entities)
except Exception as e:
LOG.exception(e)
finally:
self._rollback_to_default()
@ -194,7 +182,6 @@ class TestTopology(BaseTopologyTest):
# Calculate expected results
api_graph = self.vitrage_client.topology.get(
limit=2, graph_type='tree', query=NOVA_QUERY)
self.assertIsNotNone(api_graph)
graph = self._create_graph_from_tree_dictionary(api_graph)
entities = self._entities_validation_data(
host_entities=1, host_edges=1)
@ -204,8 +191,6 @@ class TestTopology(BaseTopologyTest):
self.num_default_entities,
self.num_default_edges,
entities)
except Exception as e:
LOG.exception(e)
finally:
self._rollback_to_default()
@ -222,7 +207,6 @@ class TestTopology(BaseTopologyTest):
# Calculate expected results
api_graph = self.vitrage_client.topology.get(
limit=3, graph_type='tree', query=NOVA_QUERY)
self.assertIsNotNone(api_graph)
graph = self._create_graph_from_tree_dictionary(api_graph)
entities = self._entities_validation_data(
host_entities=1,
@ -237,8 +221,6 @@ class TestTopology(BaseTopologyTest):
num_entities,
num_edges,
entities)
except Exception as e:
LOG.exception(e)
finally:
self._rollback_to_default()
@ -255,7 +237,6 @@ class TestTopology(BaseTopologyTest):
# Calculate expected results
api_graph = self.vitrage_client.topology.get(
limit=2, root='RESOURCE:openstack.cluster')
self.assertIsNotNone(api_graph)
graph = self._create_graph_from_graph_dictionary(api_graph)
entities = self._entities_validation_data(
host_entities=1, host_edges=1)
@ -265,8 +246,6 @@ class TestTopology(BaseTopologyTest):
self.num_default_entities,
self.num_default_edges,
entities)
except Exception as e:
LOG.exception(e)
finally:
self._rollback_to_default()
@ -283,7 +262,6 @@ class TestTopology(BaseTopologyTest):
# Calculate expected results
api_graph = self.vitrage_client.topology.get(
limit=3, root='RESOURCE:openstack.cluster')
self.assertIsNotNone(api_graph)
graph = self._create_graph_from_graph_dictionary(api_graph)
entities = self._entities_validation_data(
host_entities=1,
@ -298,8 +276,6 @@ class TestTopology(BaseTopologyTest):
num_entities,
num_edges,
entities)
except Exception as e:
LOG.exception(e)
finally:
self._rollback_to_default()
@ -347,8 +323,6 @@ class TestTopology(BaseTopologyTest):
self.assertEqual(
0,
len(api_graph['links']), 'num of edges')
except Exception as e:
LOG.exception(e)
finally:
self._rollback_to_default()
@ -368,7 +342,5 @@ class TestTopology(BaseTopologyTest):
# Test Assertions
self.assertEqual({}, api_graph)
except Exception as e:
LOG.exception(e)
finally:
self._rollback_to_default()

View File

@ -17,23 +17,15 @@ import socket
from oslo_config import cfg
from oslo_config.cfg import NoSuchOptError
from oslo_log import log as logging
from vitrage import service
import os
import oslo_messaging
import re
import subprocess
import vitrage_tempest_tests.tests
LOG = logging.getLogger(__name__)
def opts():
return [
('keystone_authtoken', vitrage_tempest_tests.tests.OPTS)
]
def get_from_terminal(command):
proc = os.popen(command)
text_out = proc.read()
@ -100,13 +92,6 @@ def change_terminal_dir(path):
LOG.debug("The path is : " + path)
def get_conf():
conf = service.prepare_service([])
for group, options in opts():
conf.register_opts(list(options), group=group)
return conf
def get_client():
transport = oslo_messaging.get_transport(cfg.CONF)
cfg.CONF.set_override('rpc_backend', 'rabbit')