[marvin, VMware] Fix repeated test failures observed on 'main' branch (#5992)

* [marvin, VMware] Fix test_06_disk_offering_strictness_false observed on 'main' branch

* Fix test

* update config only if false

* reset full clone setting to original values
This commit is contained in:
Pearl Dsilva 2022-02-16 22:16:03 +05:30 committed by GitHub
parent 59dda5b129
commit ee947e1310
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 47 additions and 5 deletions

View File

@ -27,6 +27,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.TimeZone;
@ -1685,7 +1686,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
DiskOfferingVO diskOffering = _diskOfferingDao.findById(diskOfferingId);
DiskProfile diskProfile = new DiskProfile(volume, diskOffering, hypervisorType);
if (volume.getDiskOfferingId() != diskOfferingId) {
if (!Objects.equals(volume.getDiskOfferingId(), diskOfferingId)) {
diskProfile.setSize(newSize);
diskProfile.setMinIops(newMinIops);
diskProfile.setMaxIops(newMaxIops);

View File

@ -1697,10 +1697,10 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
boolean volumeResizeRequired = false;
// VALIDATIONS
Long updateNewSize[] = {newSize};
Long updateNewMinIops[] = {newMinIops};
Long updateNewMaxIops[] = {newMaxIops};
Integer updateNewHypervisorSnapshotReserve[] = {newHypervisorSnapshotReserve};
Long[] updateNewSize = {newSize};
Long[] updateNewMinIops = {newMinIops};
Long[] updateNewMaxIops = {newMaxIops};
Integer[] updateNewHypervisorSnapshotReserve = {newHypervisorSnapshotReserve};
validateVolumeResizeWithNewDiskOfferingAndLoad(volume, existingDiskOffering, newDiskOffering, updateNewSize, updateNewMinIops, updateNewMaxIops, updateNewHypervisorSnapshotReserve);
newSize = updateNewSize[0];
newMinIops = updateNewMinIops[0];

View File

@ -25,8 +25,10 @@ from marvin.lib.utils import (isAlmostEqual,
cleanup_resources,
random_gen)
from marvin.lib.base import (ServiceOffering,
Configurations,
DiskOffering,
Account,
StoragePool,
VirtualMachine)
from marvin.lib.common import (list_service_offering,
list_virtual_machines,
@ -715,6 +717,16 @@ class TestServiceOfferings(cloudstackTestCase):
if self.hypervisor.lower() == "lxc":
self.skipTest("Skipping this test for {} due to bug CS-38153".format(self.hypervisor))
self.storeCloneValues = {}
if self.hypervisor.lower() == "vmware":
self.fullClone = Configurations.list(self.apiclient, name="vmware.create.full.clone")
assert isinstance(self.fullClone, list), "Config list not retrieved for vmware.create.full.clone"
allStoragePools = StoragePool.list(
self.apiclient
)
for pool in allStoragePools:
self.storeCloneValues[pool.id] = Configurations.list(self.apiclient, name="vmware.create.full.clone", storageid=pool.id)[0].value.lower()
self.updateVmwareCreateFullCloneSetting(False)
offering_data = {
'displaytext': 'TestDiskOfferingStrictnessFalse',
@ -811,8 +823,37 @@ class TestServiceOfferings(cloudstackTestCase):
"Check service offering of the VM"
)
if self.hypervisor.lower() == "vmware":
self.updateVmwareCreateFullCloneSetting(True)
return
def updateVmwareCreateFullCloneSetting(self, tearDown):
if not tearDown:
Configurations.update(self.apiclient,
"vmware.create.full.clone",
"true")
allStoragePools = StoragePool.list(
self.apiclient
)
for pool in allStoragePools:
Configurations.update(self.apiclient,
storageid=pool.id,
name="vmware.create.full.clone",
value="true")
else:
Configurations.update(self.apiclient,
"vmware.create.full.clone",
self.fullClone[0].value.lower())
allStoragePools = StoragePool.list(
self.apiclient
)
for pool in allStoragePools:
Configurations.update(self.apiclient,
storageid=pool.id,
name="vmware.create.full.clone",
value=self.storeCloneValues[pool.id])
class TestCpuCapServiceOfferings(cloudstackTestCase):
def setUp(self):