fix issues

This commit is contained in:
Pearl Dsilva 2026-01-14 11:22:24 -05:00
parent 4d5f819413
commit a3f3918db9
13 changed files with 45 additions and 6 deletions

View File

@ -72,6 +72,7 @@ import org.apache.logging.log4j.Logger;
import org.joda.time.Duration;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.libvirt.Connect;
@ -5607,6 +5608,7 @@ public class LibvirtComputingResourceTest {
Mockito.verify(vmDef, times(1)).addComp(Mockito.any());
}
@Ignore
public void validateGetCurrentMemAccordingToMemBallooningWithoutMemBalooning(){
VirtualMachineTO vmTo = Mockito.mock(VirtualMachineTO.class);
Mockito.when(vmTo.getType()).thenReturn(Type.User);
@ -5692,6 +5694,7 @@ public class LibvirtComputingResourceTest {
Assert.assertEquals(valueExpected, result);
}
@Ignore
public void setDiskIoDriverTestIoUring() {
DiskDef diskDef = configureAndTestSetDiskIoDriverTest(HYPERVISOR_LIBVIRT_VERSION_SUPPORTS_IOURING, HYPERVISOR_QEMU_VERSION_SUPPORTS_IOURING);
Assert.assertEquals(IoDriverPolicy.IO_URING, diskDef.getIoDriver());

View File

@ -35,6 +35,7 @@ import org.apache.cloudstack.utils.qemu.QemuImg;
import org.apache.cloudstack.utils.qemu.QemuImg.PhysicalDiskFormat;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.MockedConstruction;
@ -140,6 +141,7 @@ public class ScaleIOStoragePoolTest {
assertTrue(pool.isExternalSnapshot());
}
@Ignore
public void testGetPhysicalDiskWithWildcardFileFilter() throws Exception {
final String volumePath = "6c3362b500000001:vol-139-3d2c-12f0";
final String systemId = "218ce1797566a00f";

View File

@ -79,6 +79,7 @@ import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.cloudstack.test.utils.SpringUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@ -240,12 +241,16 @@ public class VmwareDatacenterApiUnitTest {
}
//@Test(expected = InvalidParameterValueException.class)
@Test
@Ignore
public void testAddVmwareDcToInvalidZone() throws ResourceInUseException, IllegalArgumentException, DiscoveryException, Exception {
Mockito.when(addCmd.getZoneId()).thenReturn(2L);
_vmwareDatacenterService.addVmwareDatacenter(addCmd);
}
//@Test(expected = ResourceInUseException.class)
@Test
@Ignore
public void testAddVmwareDcToZoneWithClusters() throws ResourceInUseException, IllegalArgumentException, DiscoveryException, Exception {
Mockito.when(_clusterDao.listByZoneId(1L)).thenReturn(clusterList);
_vmwareDatacenterService.addVmwareDatacenter(addCmd);
@ -264,36 +269,48 @@ public class VmwareDatacenterApiUnitTest {
}
//@Test(expected = ResourceInUseException.class)
@Test
@Ignore
public void testAddVmwareDcToZoneWithVmwareDc() throws ResourceInUseException, IllegalArgumentException, DiscoveryException, Exception {
Mockito.when(_vmwareDcDao.getVmwareDatacenterByNameAndVcenter(vmwareDcName, vCenterHost)).thenReturn(vmwareDcs);
_vmwareDatacenterService.addVmwareDatacenter(addCmd);
}
//@Test(expected = InvalidParameterValueException.class)
@Test
@Ignore
public void testAddVmwareDcWithNullUser() throws ResourceInUseException, IllegalArgumentException, DiscoveryException, Exception {
Mockito.when(addCmd.getUsername()).thenReturn(null);
_vmwareDatacenterService.addVmwareDatacenter(addCmd);
}
//@Test(expected = InvalidParameterValueException.class)
@Test
@Ignore
public void testAddVmwareDcWithNullPassword() throws ResourceInUseException, IllegalArgumentException, DiscoveryException, Exception {
Mockito.when(addCmd.getPassword()).thenReturn(null);
_vmwareDatacenterService.addVmwareDatacenter(addCmd);
}
//@Test(expected = InvalidParameterValueException.class)
@Test
@Ignore
public void testAddVmwareDcWithNullUrl() throws ResourceInUseException, IllegalArgumentException, DiscoveryException, Exception {
Mockito.when(addCmd.getVcenter()).thenReturn(null);
_vmwareDatacenterService.addVmwareDatacenter(addCmd);
}
//@Test(expected = InvalidParameterValueException.class)
@Test
@Ignore
public void testAddVmwareDcWithNullDcName() throws ResourceInUseException, IllegalArgumentException, DiscoveryException, Exception {
Mockito.when(addCmd.getName()).thenReturn(null);
_vmwareDatacenterService.addVmwareDatacenter(addCmd);
}
//@Test(expected = CloudRuntimeException.class)
@Test
@Ignore
public void testReAddVmwareDc() throws ResourceInUseException, IllegalArgumentException, DiscoveryException, Exception {
Mockito.when(_vmwareDcZoneMapDao.findByZoneId(1L)).thenReturn(dcZoneMap);
_vmwareDatacenterService.addVmwareDatacenter(addCmd);

View File

@ -37,6 +37,7 @@ import org.apache.xmlrpc.XmlRpcException;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.BDDMockito;
@ -112,6 +113,7 @@ public class CitrixResourceBaseTest {
}
@Ignore
public void testGetPathFilesException() {
String patch = citrixResourceBase.getPatchFilePath();
@ -122,6 +124,7 @@ public class CitrixResourceBaseTest {
}
}
@Ignore
public void testGetPathFilesListReturned() {
String patch = citrixResourceBase.getPatchFilePath();

View File

@ -16,6 +16,7 @@
// under the License.
package com.cloud.network.cisco;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.util.Map;
@ -136,7 +137,7 @@ public class CiscoVnmcConnectionTest {
@Test
public void testListUnassocAsa1000v() throws ExecutionException {
Map<String, String> response = connection.listUnAssocAsa1000v();
assertTrue(response.size() >= 0);
assertFalse(response.isEmpty());
fwDns = response;
}

View File

@ -32,6 +32,7 @@ import java.util.Map;
import javax.naming.ConfigurationException;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import com.cloud.agent.api.Answer;
@ -79,6 +80,7 @@ public class CiscoVnmcResourceTest {
}
//@Test
@Ignore
public void resourceConfigure() throws ConfigurationException {
_resource.configure("CiscoVnmcResource", _parameters);
assertTrue("CiscoVnmc".equals(_resource.getName()));
@ -86,6 +88,7 @@ public class CiscoVnmcResourceTest {
}
//@Test
@Ignore
public void testInitialization() throws ConfigurationException {
_resource.configure("CiscoVnmcResource", _parameters);
StartupCommand[] sc = _resource.initialize();

View File

@ -105,7 +105,7 @@ public class NsxNetworkCommand extends NsxCommand {
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
NsxNetworkCommand that = (NsxNetworkCommand) o;
return networkResourceId == that.networkResourceId && vmId == that.vmId &&
return networkResourceId.equals(that.networkResourceId) && vmId.equals(that.vmId) &&
Objects.equals(networkResourceName, that.networkResourceName) && Objects.equals(publicIp, that.publicIp)
&& Objects.equals(vmIp, that.vmIp);
}

View File

@ -24,6 +24,7 @@ import com.cloud.exception.ResourceUnavailableException;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.network.tungsten.api.response.TungstenFabricRuleResponse;
import org.apache.cloudstack.network.tungsten.service.TungstenService;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@ -67,6 +68,7 @@ public class AddTungstenFabricPolicyRuleCmdTest {
ReflectionTestUtils.setField(addTungstenFabricPolicyRuleCmd, "destEndPort", 1);
}
@After
public void tearDown() throws Exception {
closeable.close();
}

View File

@ -24,6 +24,7 @@ import com.cloud.exception.ResourceUnavailableException;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.network.tungsten.api.response.TungstenFabricFirewallRuleResponse;
import org.apache.cloudstack.network.tungsten.service.TungstenService;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@ -66,6 +67,7 @@ public class CreateTungstenFabricFirewallRuleCmdTest {
ReflectionTestUtils.setField(createTungstenFabricFirewallRuleCmd, "sequence", 1);
}
@After
public void tearDown() throws Exception {
closeable.close();
}

View File

@ -25,6 +25,7 @@ import com.cloud.network.TungstenProvider;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.network.tungsten.api.response.TungstenFabricProviderResponse;
import org.apache.cloudstack.network.tungsten.service.TungstenProviderService;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@ -60,6 +61,7 @@ public class CreateTungstenFabricProviderCmdTest {
ReflectionTestUtils.setField(createTungstenFabricProviderCmd, "introspectPort", "test");
}
@After
public void tearDown() throws Exception {
closeable.close();
}

View File

@ -18,6 +18,7 @@ package org.apache.cloudstack.network.tungsten.api.command;
import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.cloudstack.network.tungsten.service.TungstenService;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@ -47,6 +48,7 @@ public class DeleteTungstenFabricTagCmdTest {
ReflectionTestUtils.setField(deleteTungstenFabricTagCmd, "tagUuid", "test");
}
@After
public void tearDown() throws Exception {
closeable.close();
}

View File

@ -24,6 +24,7 @@ import com.cloud.exception.ResourceUnavailableException;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.network.tungsten.api.response.TungstenFabricTagResponse;
import org.apache.cloudstack.network.tungsten.service.TungstenService;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@ -61,6 +62,7 @@ public class RemoveTungstenFabricTagCmdTest {
ReflectionTestUtils.setField(removeTungstenFabricTagCmd, "tagUuid", "test");
}
@After
public void tearDown() throws Exception {
closeable.close();
}

View File

@ -417,10 +417,10 @@ public class AutoScaleManagerImplTest {
when(asPolicyDao.persist(any(AutoScalePolicyVO.class))).thenReturn(asScaleUpPolicyMock);
HashMap<String, String> userDataMap = new HashMap<>();
userDataMap.put("key1", "value1");
userDataMap.put("key2", "value2");
userDataDetails.put("0", userDataMap);
HashMap<String, String> mapValues = new HashMap<>();
mapValues.put("key1", "value1");
mapValues.put("key2", "value2");
userDataDetails.put("0", mapValues);
Mockito.doReturn(userDataFinal).when(userVmMgr).finalizeUserData(any(), any(), any());
Mockito.doReturn(userDataFinal).when(userDataMgr).validateUserData(eq(userDataFinal), nullable(BaseCmd.HTTPMethod.class));
}