Skip to content

Commit db9ac68

Browse files
committed
fixed failing tests
1 parent e462dfe commit db9ac68

4 files changed

Lines changed: 16 additions & 13 deletions

File tree

common/utilites/command_result.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
COMMAND_RESULT_PREFIX = "command_json_result="
44
COMMAND_RESULT_POSTFIX = "=command_json_result_end"
55

6-
def get_result_from_command_output(output):
76

7+
def get_result_from_command_output(output):
88
match = search(COMMAND_RESULT_PREFIX + '(?P<result>.*)' + COMMAND_RESULT_POSTFIX, output)
99
if not match:
10-
return output
10+
return None
1111
return match.group('result')
1212

13+
1314
def set_command_result(output):
14-
print COMMAND_RESULT_PREFIX + str(output) + COMMAND_RESULT_POSTFIX
15+
print COMMAND_RESULT_PREFIX + str(output) + COMMAND_RESULT_POSTFIX

deployed_app_service/proxy/deployed_app_proxy.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,17 @@ def execute_command_on_vcenter_resource(generic_deployed_app_resource_model, com
100100
inputs,
101101
True)
102102

103-
result = get_result_from_command_output(command_result.Output)
104-
_logger.info('Command ' + command + ' result: ' + result)
105-
return result
103+
_logger.info('Command ' + command + ' result: ' + command_result.Output)
104+
105+
return command_result
106106

107107
@staticmethod
108-
def execute_command_on_vcenter_resource_and_passthrough_result(generic_deployed_app_resource_model, command, inputs):
109-
result = DeployedAppService.execute_command_on_vcenter_resource(generic_deployed_app_resource_model,
110-
command,
111-
inputs)
108+
def execute_command_on_vcenter_resource_and_passthrough_result(generic_deployed_app_resource_model, command,
109+
inputs):
110+
command_result = DeployedAppService.execute_command_on_vcenter_resource(generic_deployed_app_resource_model,
111+
command,
112+
inputs)
112113

114+
result = get_result_from_command_output(command_result.Output)
113115
_logger.debug('Transferring result to the caller ' + result)
114116
set_command_result(result)

tests/test_command_executer_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def test_destroyVirtualMachineCommand(self):
163163
CommandContextMocker.set_vm_uuid_param(VmContext.VM_UUID)
164164

165165
# act
166-
command_executer_service.destroy()
166+
command_executer_service.destroy_vm()
167167

168168
# assert
169169
self.assertTrue(connection_retriever.getVCenterInventoryPathAttributeData.called_with(resource_att))

tests/test_commands/test_power_management_vm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def test_power_on(self):
2626
power_manager = VirtualMachinePowerManagementCommand(pv_service, synchronous_task_waiter)
2727

2828
# act
29-
res = power_manager.power_on(si, vm_uuid)
29+
res = power_manager.power_on(si, vm_uuid, None)
3030

3131
# assert
3232
self.assertTrue(res)
@@ -53,7 +53,7 @@ def test_power_off(self):
5353
power_manager._get_vm = Mock(return_value=vm)
5454

5555
# act
56-
res = power_manager.power_off(si, vm_uuid)
56+
res = power_manager.power_off(si, vm_uuid, None)
5757

5858
# assert
5959
self.assertTrue(res)

0 commit comments

Comments
 (0)