cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From karuturi <...@git.apache.org>
Subject [GitHub] cloudstack pull request: CLOUDSTACK-8607 - As an Operator I want t...
Date Mon, 06 Jul 2015 11:01:06 GMT
Github user karuturi commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/559#discussion_r33923859
  
    --- 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 --
    
    Agreed on the intention of the test. I think the below interaction for executeInVR is
not needed (as it is never called)
    `when(citrixResourceBase.executeInVR(updatePwd.getHostIp(), VRScripts.UPDATE_HOST_PASSWD,
buff.toString())).thenReturn(executionResult);`
    
    Instead if we could mock `SshHelper.sshExecute()` and test both for success and failure
of the sshExecute, that would cover all the branches.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message