cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cristofolini <...@git.apache.org>
Subject [GitHub] cloudstack pull request: CLOUDSTACK-9368: Fix for Support configur...
Date Sun, 01 May 2016 23:08:21 GMT
Github user cristofolini commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1518#discussion_r61694862
  
    --- Diff: plugins/hypervisors/vmware/test/com/cloud/hypervisor/vmware/resource/VmwareResourceTest.java
---
    @@ -117,4 +154,79 @@ public void testStartVm3dgpuEnabled() throws Exception{
             verify(vmMo3dgpu).configureVm(any(VirtualMachineConfigSpec.class));
         }
     
    -}
    +    // ---------------------------------------------------------------------------------------------------
    +
    +    @Test
    +    public void testgetNfsVersionFromNfsTONull(){
    +        assertFalse(_resource.getStorageNfsVersionFromNfsTO(null));
    +    }
    +
    +    @Test
    +    public void testgetNfsVersionFromNfsTONfsVersionNull(){
    +        when(srcDataNfsTO.getNfsVersion()).thenReturn(NFS_VERSION_NOT_PRESENT);
    +        assertFalse(_resource.getStorageNfsVersionFromNfsTO(srcDataNfsTO));
    +    }
    +
    +    @Test
    +    public void testgetNfsVersionFromNfsTONfsVersion(){
    +        assertTrue(_resource.getStorageNfsVersionFromNfsTO(srcDataNfsTO));
    +    }
    +
    +    // ---------------------------------------------------------------------------------------------------
    +
    +    @Test
    +    public void testSetCurrentNfsVersionInProcessorAndHandler(){
    +        _resource.setCurrentNfsVersionInProcessorAndHandler();
    +        verify(storageHandler).reconfigureNfsVersion(any(Integer.class));
    +    }
    +
    +    // ---------------------------------------------------------------------------------------------------
    +
    +    @Test
    +    public void testExamineStorageSubSystemCommandNfsVersionNotPresent(){
    +        when(srcDataNfsTO.getNfsVersion()).thenReturn(NFS_VERSION_NOT_PRESENT);
    +        _resource.examineStorageSubSystemCommandNfsVersion(storageCmd);
    +        verify(_resource, never()).setCurrentNfsVersionInProcessorAndHandler();
    +    }
    +
    +    @Test
    +    public void testExamineStorageSubSystemCommandNfsVersion(){
    +        _resource.examineStorageSubSystemCommandNfsVersion(storageCmd);
    +        verify(_resource).setCurrentNfsVersionInProcessorAndHandler();
    +    }
    +
    +    // ---------------------------------------------------------------------------------------------------
    +
    +    @Test
    +    public void testStorageSetNfsVersion(){
    --- End diff --
    
    It does seem this test would work out better if it were to be split into two. I'd recommend
just testing out the two possibilities of execution for the `checkStorageProcessorAndHandlerNfsVersionAttribute`
method, one test for the possibility that it will just return when the version is already
set, and another one where it should set the version if it isn't already. As for naming, I'd
recommend `checkStorageProcessorAndHandlerNfsVersionAttributeVersionNotSet` and `checkStorageProcessorAndHandlerNfsVersionAttributeVersionSet`
respectively, but that's up to you, @nvazquez. :)
    
    Separate tests are better in situations like this since they allow us to determine in
what case(s) a method is failing to execute properly a bit more precisely.


---
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