Github user wilderrodrigues commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/559#discussion_r33925325
  
    --- Diff: 
plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixRequestWrapperTest.java
 ---
    @@ -1320,14 +1322,23 @@ public void testOvsDestroyTunnelCommandFailed() {
     
         @Test
         public void testUpdateHostPasswordCommand() {
    -        final UpdateHostPasswordCommand updatePwd = new 
UpdateHostPasswordCommand("test", "123");
    +        final ExecutionResult executionResult = 
Mockito.mock(ExecutionResult.class);
    +
    +        final UpdateHostPasswordCommand updatePwd = new 
UpdateHostPasswordCommand("test", "123", "127.0.0.1");
    +
    +        final StringBuffer buff = new StringBuffer();
    +        buff.append(updatePwd.getUsername());
    +        buff.append(' ');
    +        buff.append(updatePwd.getNewPassword());
    +
    +        when(citrixResourceBase.executeInVR(updatePwd.getHostIp(), 
VRScripts.UPDATE_HOST_PASSWD, buff.toString())).thenReturn(executionResult);
    --- End diff --
    
    That's what I was discussing with @DaanHoogland here. In order to make it 
better, we have to extract the Script creation into the existing utilities 
class and mock it. So we can cover both false/true cases.
    
    But wait, whilst reading both of your comments again, I realised that I was 
looking into the wrong test file. It might have been result of a initial 
version of the test. The mock + the when() call should not be there at all.
    
    That's how I will proceed:
    
    1. remove the unused Mock/call
    2. extract the SshHelper so we can cover both scenarios
    3. apply the similar changes to LibvirtUpdateHostPasswordCommandWrapper
    
    Sorry for the misunderstanding.
    
    Cheers,
    Wilder



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to