Added unit tests on actions
As we had a low test coverage on actions, I added some more tests with this patchset. This actually revealed a small bug (typo) in "change_nova_service_state" which has been fixed in here. Note that Tempest test also cover these action via the basic_consolidation strategy. Change-Id: I2d7116a6fdefee82ca254512a9cf50fc61e3c80e Closes-Bug: #1523513
This commit is contained in:
@@ -54,9 +54,9 @@ class ChangeNovaServiceState(base.BaseAction):
|
||||
target_state = None
|
||||
if self.state == hstate.HypervisorState.OFFLINE.value:
|
||||
target_state = False
|
||||
elif self.status == hstate.HypervisorState.ONLINE.value:
|
||||
elif self.state == hstate.HypervisorState.ONLINE.value:
|
||||
target_state = True
|
||||
return self.nova_manage_service(target_state)
|
||||
return self._nova_manage_service(target_state)
|
||||
|
||||
def revert(self):
|
||||
target_state = None
|
||||
@@ -64,9 +64,9 @@ class ChangeNovaServiceState(base.BaseAction):
|
||||
target_state = True
|
||||
elif self.state == hstate.HypervisorState.ONLINE.value:
|
||||
target_state = False
|
||||
return self.nova_manage_service(target_state)
|
||||
return self._nova_manage_service(target_state)
|
||||
|
||||
def nova_manage_service(self, state):
|
||||
def _nova_manage_service(self, state):
|
||||
if state is None:
|
||||
raise exception.IllegalArgumentException(
|
||||
message=_("The target state is not defined"))
|
||||
|
||||
Reference in New Issue
Block a user