rhtyd commented on a change in pull request #2665: configdrive: run unit test 
only for Linux
URL: https://github.com/apache/cloudstack/pull/2665#discussion_r190485989
 
 

 ##########
 File path: 
server/test/com/cloud/network/element/ConfigDriveNetworkElementTest.java
 ##########
 @@ -242,34 +242,4 @@ public void testGetCapabilities () {
         assertThat(_configDrivesNetworkElement.getCapabilities(), 
hasEntry(Network.Service.UserData, null));
     }
 
-    @Test
-    public void testAddPasswordAndUserData() throws Exception {
-        final Answer answer = mock(Answer.class);
-        final UserVmDetailVO userVmDetailVO = mock(UserVmDetailVO.class);
-        when(agentManager.easySend(anyLong(), 
any(HandleConfigDriveIsoCommand.class))).thenReturn(answer);
-        when(answer.getResult()).thenReturn(true);
-        when(network.getTrafficType()).thenReturn(Networks.TrafficType.Guest);
-        
when(virtualMachine.getState()).thenReturn(VirtualMachine.State.Stopped);
-        when(virtualMachine.getUuid()).thenReturn("vm-uuid");
-        when(userVmDetailVO.getValue()).thenReturn(PUBLIC_KEY);
-        when(nicp.getIPv4Address()).thenReturn("192.168.111.111");
-        when(_userVmDetailsDao.findDetail(anyLong(), 
anyString())).thenReturn(userVmDetailVO);
-        when(_ipAddressDao.findByAssociatedVmId(VMID)).thenReturn(publicIp);
-        when(publicIp.getAddress()).thenReturn(new Ip("7.7.7.7"));
-
-        Map<VirtualMachineProfile.Param, Object> parms = Maps.newHashMap();
-        parms.put(VirtualMachineProfile.Param.VmPassword, PASSWORD);
-        parms.put(VirtualMachineProfile.Param.VmSshPubKey, PUBLIC_KEY);
-        VirtualMachineProfile profile = new 
VirtualMachineProfileImpl(virtualMachine, null, serviceOfferingVO, null, parms);
-        assertTrue(_configDrivesNetworkElement.addPasswordAndUserdata(
-                network, nicp, profile, deployDestination, null));
-
-        ArgumentCaptor<HandleConfigDriveIsoCommand> commandCaptor = 
ArgumentCaptor.forClass(HandleConfigDriveIsoCommand.class);
-        verify(agentManager, times(1)).easySend(anyLong(), 
commandCaptor.capture());
-        HandleConfigDriveIsoCommand createCommand = commandCaptor.getValue();
-
-        assertTrue(createCommand.isCreate());
-        assertTrue(createCommand.getIsoData().length() > 0);
-        
assertTrue(createCommand.getIsoFile().equals(ConfigDrive.createConfigDrivePath(profile.getInstanceName())));
 
 Review comment:
   @DaanHoogland we don't need to remove this unit test, instead just mock the 
call that `addPasswordAndUserdata` makes to the ConfigDriveBuilder static 
method which is tricky but do-able.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to