Tempest fix
Last commit existing 'trigger' variable was accidentally overridden. Change-Id: I52c5e594c48e326ba73be3837d2196b8701082d4
This commit is contained in:
parent
dcde8a970e
commit
31667cc78a
@ -91,11 +91,11 @@ class TestBasicActions(TestActionsBase):
|
|||||||
def test_action_set_state_host_v3(self):
|
def test_action_set_state_host_v3(self):
|
||||||
self._do_test_action_set_state_host(TRIGGER_ALARM_1_V3)
|
self._do_test_action_set_state_host(TRIGGER_ALARM_1_V3)
|
||||||
|
|
||||||
def _do_test_action_set_state_host(self, trigger):
|
def _do_test_action_set_state_host(self, trigger_name):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
# Do
|
# Do
|
||||||
self._trigger_do_action(trigger)
|
self._trigger_do_action(trigger_name)
|
||||||
curr_host = v_utils.get_first_host()
|
curr_host = v_utils.get_first_host()
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
'ERROR',
|
'ERROR',
|
||||||
@ -103,7 +103,7 @@ class TestBasicActions(TestActionsBase):
|
|||||||
'state should change after set_state action')
|
'state should change after set_state action')
|
||||||
|
|
||||||
# Undo
|
# Undo
|
||||||
self._trigger_undo_action(trigger)
|
self._trigger_undo_action(trigger_name)
|
||||||
curr_host = v_utils.get_first_host()
|
curr_host = v_utils.get_first_host()
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
self.orig_host.get(VProps.VITRAGE_AGGREGATED_STATE),
|
self.orig_host.get(VProps.VITRAGE_AGGREGATED_STATE),
|
||||||
@ -113,7 +113,7 @@ class TestBasicActions(TestActionsBase):
|
|||||||
self._handle_exception(e)
|
self._handle_exception(e)
|
||||||
raise
|
raise
|
||||||
finally:
|
finally:
|
||||||
self._trigger_undo_action(trigger)
|
self._trigger_undo_action(trigger_name)
|
||||||
|
|
||||||
@utils.tempest_logger
|
@utils.tempest_logger
|
||||||
def test_action_set_state_instance(self):
|
def test_action_set_state_instance(self):
|
||||||
@ -123,7 +123,7 @@ class TestBasicActions(TestActionsBase):
|
|||||||
def test_action_set_state_instance_v3(self):
|
def test_action_set_state_instance_v3(self):
|
||||||
self._do_test_action_set_state_instance(TRIGGER_ALARM_3_V3)
|
self._do_test_action_set_state_instance(TRIGGER_ALARM_3_V3)
|
||||||
|
|
||||||
def _do_test_action_set_state_instance(self, trigger):
|
def _do_test_action_set_state_instance(self, trigger_name):
|
||||||
|
|
||||||
vm_id = ""
|
vm_id = ""
|
||||||
try:
|
try:
|
||||||
@ -131,7 +131,7 @@ class TestBasicActions(TestActionsBase):
|
|||||||
|
|
||||||
# Do
|
# Do
|
||||||
orig_instance = v_utils.get_first_instance(id=vm_id)
|
orig_instance = v_utils.get_first_instance(id=vm_id)
|
||||||
self._trigger_do_action(trigger)
|
self._trigger_do_action(trigger_name)
|
||||||
curr_instance = v_utils.get_first_instance(id=vm_id)
|
curr_instance = v_utils.get_first_instance(id=vm_id)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
'ERROR',
|
'ERROR',
|
||||||
@ -139,7 +139,7 @@ class TestBasicActions(TestActionsBase):
|
|||||||
'state should change after set_state action')
|
'state should change after set_state action')
|
||||||
|
|
||||||
# Undo
|
# Undo
|
||||||
self._trigger_undo_action(trigger)
|
self._trigger_undo_action(trigger_name)
|
||||||
curr_instance = v_utils.get_first_instance(id=vm_id)
|
curr_instance = v_utils.get_first_instance(id=vm_id)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
orig_instance.get(VProps.VITRAGE_AGGREGATED_STATE),
|
orig_instance.get(VProps.VITRAGE_AGGREGATED_STATE),
|
||||||
@ -149,7 +149,7 @@ class TestBasicActions(TestActionsBase):
|
|||||||
self._handle_exception(e)
|
self._handle_exception(e)
|
||||||
raise
|
raise
|
||||||
finally:
|
finally:
|
||||||
self._trigger_undo_action(trigger)
|
self._trigger_undo_action(trigger_name)
|
||||||
nova_utils.delete_all_instances(id=vm_id)
|
nova_utils.delete_all_instances(id=vm_id)
|
||||||
|
|
||||||
@utils.tempest_logger
|
@utils.tempest_logger
|
||||||
@ -160,18 +160,18 @@ class TestBasicActions(TestActionsBase):
|
|||||||
def test_action_mark_down_host_v3(self):
|
def test_action_mark_down_host_v3(self):
|
||||||
self._do_test_action_mark_down_host(TRIGGER_ALARM_4_V3)
|
self._do_test_action_mark_down_host(TRIGGER_ALARM_4_V3)
|
||||||
|
|
||||||
def _do_test_action_mark_down_host(self, trigger):
|
def _do_test_action_mark_down_host(self, trigger_name):
|
||||||
try:
|
try:
|
||||||
host_name = self.orig_host.get(VProps.NAME)
|
host_name = self.orig_host.get(VProps.NAME)
|
||||||
|
|
||||||
# Do
|
# Do
|
||||||
self._trigger_do_action(trigger)
|
self._trigger_do_action(trigger_name)
|
||||||
nova_service = TempestClients.nova().services.list(
|
nova_service = TempestClients.nova().services.list(
|
||||||
host=host_name, binary='nova-compute')[0]
|
host=host_name, binary='nova-compute')[0]
|
||||||
self.assertEqual("down", str(nova_service.state))
|
self.assertEqual("down", str(nova_service.state))
|
||||||
|
|
||||||
# Undo
|
# Undo
|
||||||
self._trigger_undo_action(trigger)
|
self._trigger_undo_action(trigger_name)
|
||||||
nova_service = TempestClients.nova().services.list(
|
nova_service = TempestClients.nova().services.list(
|
||||||
host=host_name, binary='nova-compute')[0]
|
host=host_name, binary='nova-compute')[0]
|
||||||
self.assertEqual("up", str(nova_service.state))
|
self.assertEqual("up", str(nova_service.state))
|
||||||
@ -179,7 +179,7 @@ class TestBasicActions(TestActionsBase):
|
|||||||
self._handle_exception(e)
|
self._handle_exception(e)
|
||||||
raise
|
raise
|
||||||
finally:
|
finally:
|
||||||
self._trigger_undo_action(trigger)
|
self._trigger_undo_action(trigger_name)
|
||||||
# nova.host datasource may take up to snapshot_intreval to update
|
# nova.host datasource may take up to snapshot_intreval to update
|
||||||
time.sleep(130)
|
time.sleep(130)
|
||||||
|
|
||||||
@ -191,17 +191,17 @@ class TestBasicActions(TestActionsBase):
|
|||||||
def test_action_mark_down_instance_v3(self):
|
def test_action_mark_down_instance_v3(self):
|
||||||
self._do_test_action_mark_down_instance(TRIGGER_ALARM_5_V3)
|
self._do_test_action_mark_down_instance(TRIGGER_ALARM_5_V3)
|
||||||
|
|
||||||
def _do_test_action_mark_down_instance(self, trigger):
|
def _do_test_action_mark_down_instance(self, trigger_name):
|
||||||
vm_id = ""
|
vm_id = ""
|
||||||
try:
|
try:
|
||||||
vm_id = nova_utils.create_instances(set_public_network=True)[0].id
|
vm_id = nova_utils.create_instances(set_public_network=True)[0].id
|
||||||
# Do
|
# Do
|
||||||
self._trigger_do_action(trigger)
|
self._trigger_do_action(trigger_name)
|
||||||
nova_instance = TempestClients.nova().servers.get(vm_id)
|
nova_instance = TempestClients.nova().servers.get(vm_id)
|
||||||
self.assertEqual("ERROR", str(nova_instance.status))
|
self.assertEqual("ERROR", str(nova_instance.status))
|
||||||
|
|
||||||
# Undo
|
# Undo
|
||||||
self._trigger_undo_action(trigger)
|
self._trigger_undo_action(trigger_name)
|
||||||
nova_instance = TempestClients.nova().servers.get(vm_id)
|
nova_instance = TempestClients.nova().servers.get(vm_id)
|
||||||
self.assertEqual("ACTIVE", str(nova_instance.status))
|
self.assertEqual("ACTIVE", str(nova_instance.status))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -209,7 +209,7 @@ class TestBasicActions(TestActionsBase):
|
|||||||
raise
|
raise
|
||||||
finally:
|
finally:
|
||||||
pass
|
pass
|
||||||
self._trigger_undo_action(trigger)
|
self._trigger_undo_action(trigger_name)
|
||||||
nova_utils.delete_all_instances(id=vm_id)
|
nova_utils.delete_all_instances(id=vm_id)
|
||||||
|
|
||||||
@utils.tempest_logger
|
@utils.tempest_logger
|
||||||
@ -220,22 +220,22 @@ class TestBasicActions(TestActionsBase):
|
|||||||
def test_action_deduce_alarm_v3(self):
|
def test_action_deduce_alarm_v3(self):
|
||||||
self._do_test_action_deduce_alarm(TRIGGER_ALARM_2_V3, DEDUCED_PROPS_V3)
|
self._do_test_action_deduce_alarm(TRIGGER_ALARM_2_V3, DEDUCED_PROPS_V3)
|
||||||
|
|
||||||
def _do_test_action_deduce_alarm(self, trigger, deduced_props):
|
def _do_test_action_deduce_alarm(self, trigger_name, deduced_props):
|
||||||
try:
|
try:
|
||||||
host_id = self.orig_host.get(VProps.VITRAGE_ID)
|
host_id = self.orig_host.get(VProps.VITRAGE_ID)
|
||||||
|
|
||||||
# Do
|
# Do
|
||||||
self._trigger_do_action(trigger)
|
self._trigger_do_action(trigger_name)
|
||||||
self._check_deduced(1, deduced_props, host_id)
|
self._check_deduced(1, deduced_props, host_id)
|
||||||
|
|
||||||
# Undo
|
# Undo
|
||||||
self._trigger_undo_action(trigger)
|
self._trigger_undo_action(trigger_name)
|
||||||
self._check_deduced(0, deduced_props, host_id)
|
self._check_deduced(0, deduced_props, host_id)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self._handle_exception(e)
|
self._handle_exception(e)
|
||||||
raise
|
raise
|
||||||
finally:
|
finally:
|
||||||
self._trigger_undo_action(trigger)
|
self._trigger_undo_action(trigger_name)
|
||||||
|
|
||||||
@utils.tempest_logger
|
@utils.tempest_logger
|
||||||
def test_action_add_causal_relationship(self):
|
def test_action_add_causal_relationship(self):
|
||||||
@ -250,12 +250,12 @@ class TestBasicActions(TestActionsBase):
|
|||||||
TRIGGER_ALARM_2_PROPS_V3)
|
TRIGGER_ALARM_2_PROPS_V3)
|
||||||
|
|
||||||
def _do_test_action_add_causal_relationship(self,
|
def _do_test_action_add_causal_relationship(self,
|
||||||
trigger,
|
trigger_name,
|
||||||
deduced_props,
|
deduced_props,
|
||||||
trigger_alarm_props):
|
trigger_alarm_props):
|
||||||
try:
|
try:
|
||||||
# Do
|
# Do
|
||||||
self._trigger_do_action(trigger)
|
self._trigger_do_action(trigger_name)
|
||||||
alarms = TempestClients.vitrage().alarm.list(
|
alarms = TempestClients.vitrage().alarm.list(
|
||||||
vitrage_id=self.orig_host.get(VProps.VITRAGE_ID),
|
vitrage_id=self.orig_host.get(VProps.VITRAGE_ID),
|
||||||
all_tenants=True)
|
all_tenants=True)
|
||||||
@ -277,4 +277,4 @@ class TestBasicActions(TestActionsBase):
|
|||||||
self._handle_exception(e)
|
self._handle_exception(e)
|
||||||
raise
|
raise
|
||||||
finally:
|
finally:
|
||||||
self._trigger_undo_action(trigger)
|
self._trigger_undo_action(trigger_name)
|
||||||
|
Loading…
Reference in New Issue
Block a user