tempest stability

1. set state test should not run mark down
2. ports may remain after vms were deleted

Change-Id: If6d8cf171dfc94f95a0d5f6f7ba235f60f010310
This commit is contained in:
Idan Hefetz 2018-05-27 07:15:28 +00:00
parent baef7b92c9
commit 0d8e900811
3 changed files with 25 additions and 4 deletions
vitrage_tempest_plugin/tests

@ -39,6 +39,8 @@ from vitrage.graph.driver.networkx_graph import NXGraph
from vitrage.graph import Edge
from vitrage.graph import Vertex
from vitrage import service
from vitrage_tempest_plugin.tests.common import general_utils
from vitrage_tempest_plugin.tests.common.tempest_clients import TempestClients
from vitrage_tempest_plugin.tests import utils
@ -132,11 +134,17 @@ class BaseVitrageTempest(base.BaseTestCase):
cls.num_default_networks = \
len(TempestClients.neutron().list_networks()['networks'])
cls.num_default_ports = 0
cls.num_default_ports = cls._get_num_default_ports()
cls.num_default_entities = 3
cls.num_default_edges = 2
cls.num_demo_tenant_networks = cls._calc_num_demo_tenant_networks()
@classmethod
def _get_num_default_ports(cls):
ports = TempestClients.neutron().list_ports()['ports']
return len(general_utils.all_matches(
ports, device_owner='compute:nova'))
def _create_graph_from_graph_dictionary(self, api_graph):
self.assertIsNotNone(api_graph)
graph = NXGraph()

@ -33,6 +33,7 @@ TRIGGER_ALARM_1 = 'e2e.test_basic_actions.trigger.alarm1'
TRIGGER_ALARM_2 = 'e2e.test_basic_actions.trigger.alarm2'
TRIGGER_ALARM_3 = 'e2e.test_basic_actions.trigger.alarm3'
TRIGGER_ALARM_4 = 'e2e.test_basic_actions.trigger.alarm4'
TRIGGER_ALARM_5 = 'e2e.test_basic_actions.trigger.alarm5'
DEDUCED = 'e2e.test_basic_actions.deduced.alarm'
TRIGGER_ALARM_2_PROPS = {
@ -150,12 +151,12 @@ class TestBasicActions(TestActionsBase):
try:
vm_id = nova_utils.create_instances(set_public_network=True)[0].id
# Do
self._trigger_do_action(TRIGGER_ALARM_3)
self._trigger_do_action(TRIGGER_ALARM_5)
nova_instance = TempestClients.nova().servers.get(vm_id)
self.assertEqual("ERROR", str(nova_instance.status))
# Undo
self._trigger_undo_action(TRIGGER_ALARM_3)
self._trigger_undo_action(TRIGGER_ALARM_5)
nova_instance = TempestClients.nova().servers.get(vm_id)
self.assertEqual("ACTIVE", str(nova_instance.status))
except Exception as e:
@ -163,7 +164,7 @@ class TestBasicActions(TestActionsBase):
raise
finally:
pass
self._trigger_undo_action(TRIGGER_ALARM_3)
self._trigger_undo_action(TRIGGER_ALARM_5)
nova_utils.delete_all_instances(id=vm_id)
@utils.tempest_logger

@ -19,6 +19,10 @@ definitions:
category: ALARM
name: e2e.test_basic_actions.trigger.alarm4
template_id: trigger_alarm_4
- entity:
category: ALARM
name: e2e.test_basic_actions.trigger.alarm5
template_id: trigger_alarm_5
- entity:
category: ALARM
type: vitrage
@ -53,6 +57,11 @@ definitions:
relationship_type: on
target: host
template_id : trigger_alarm_4_on_host
- relationship:
source: trigger_alarm_5
relationship_type: on
target: host
template_id : trigger_alarm_5_on_host
- relationship:
source: deduced_alarm
relationship_type: on
@ -107,6 +116,9 @@ scenarios:
target: instance
properties:
state: ERROR
- scenario:
condition: trigger_alarm_5_on_host and host_contains_instance
actions:
- action:
action_type: mark_down
action_target: