GabrielBrascher commented on a change in pull request #2653: Generate MAC
address if the MAC in command addNicToVirtualMachine is invalid
URL: https://github.com/apache/cloudstack/pull/2653#discussion_r189441332
##########
File path: server/test/com/cloud/vm/UserVmManagerImplTest.java
##########
@@ -217,8 +221,42 @@ private void
configureDoNothingForMethodsThatWeDoNotWantToTest() throws Resource
Mockito.doNothing().when(userVmManagerImpl).validateInputsAndPermissionForUpdateVirtualMachineCommand(updateVmCommand);
Mockito.doReturn(new
ArrayList<Long>()).when(userVmManagerImpl).getSecurityGroupIdList(updateVmCommand);
Mockito.doReturn(Mockito.mock(UserVm.class)).when(userVmManagerImpl).updateVirtualMachine(Mockito.anyLong(),
Mockito.anyString(), Mockito.anyString(), Mockito.anyBoolean(),
- Mockito.anyBoolean(), Mockito.anyLong(),
- Mockito.anyString(), Mockito.anyBoolean(),
Mockito.any(HTTPMethod.class), Mockito.anyString(), Mockito.anyString(),
Mockito.anyString(), Mockito.anyListOf(Long.class),
- Mockito.anyMap());
+ Mockito.anyBoolean(), Mockito.anyLong(), Mockito.anyString(),
Mockito.anyBoolean(), Mockito.any(HTTPMethod.class), Mockito.anyString(),
Mockito.anyString(),
+ Mockito.anyString(), Mockito.anyListOf(Long.class),
Mockito.anyMap());
+ }
+
+ @Test
+ public void
lookForNextAvailableMacAddressInNetworkIfMacIsInvalidTestMacAddressNotNull()
throws InsufficientAddressCapacityException {
+ configureGetNextAvailableMacAddressInNetworkIfMacIsNull(0,
"00:00:00:00:00:00", "00:00:00:00:00:00");
+ }
+
+ @Test
+ public void
lookForNextAvailableMacAddressInNetworkIfMacIsInvalidTestMacAddressNull()
throws InsufficientAddressCapacityException {
+ configureGetNextAvailableMacAddressInNetworkIfMacIsNull(1, null,
"00:00:00:00:00:00");
+ }
+
+ @Test
+ public void
lookForNextAvailableMacAddressInNetworkIfMacIsInvalidTestMacAddressBlank()
throws InsufficientAddressCapacityException {
+ configureGetNextAvailableMacAddressInNetworkIfMacIsNull(1, " ",
"00:00:00:00:00:00");
+ }
+
+ @Test
+ public void
lookForNextAvailableMacAddressInNetworkIfMacIsInvalidTestMacAddressEmpty()
throws InsufficientAddressCapacityException {
+ configureGetNextAvailableMacAddressInNetworkIfMacIsNull(1, "",
"00:00:00:00:00:00");
+ }
+
+ @Test
+ public void
lookForNextAvailableMacAddressInNetworkIfMacIsInvalidTestMacAddressNotValid()
throws InsufficientAddressCapacityException {
+ configureGetNextAvailableMacAddressInNetworkIfMacIsNull(1,
"00:00:00:00:00", "00:00:00:00:00:00");
+ }
+
+ private void
configureLookForNextAvailableMacAddressInNetworkIfMacIsInvalid(int times,
String macAddress, String expectedMacAddress) throws
InsufficientAddressCapacityException {
Review comment:
Sure, Thanks!
----------------------------------------------------------------
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