mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-2884: Fixed test_04_change_offering_small
Added method to compare if two digits are almost equal within given range Signed-off-by: Prasanna Santhanam <tsp@apache.org>
This commit is contained in:
parent
daa4c326aa
commit
048cf5aae8
|
|
@ -273,6 +273,21 @@ class TestServiceOfferings(cloudstackTestCase):
|
|||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||
return
|
||||
|
||||
def isAlmostEqual(self, first_digit, second_digit, range=0):
|
||||
|
||||
digits_equal_within_range = False
|
||||
|
||||
try:
|
||||
if ((first_digit - range) < second_digit < (first_digit + range)):
|
||||
digits_equal_within_range = True
|
||||
|
||||
except Exception as e:
|
||||
self.fail(
|
||||
"%s: Failed while comparing the numbers %s & %s" %
|
||||
(e, first_digit, second_digit))
|
||||
|
||||
return digits_equal_within_range
|
||||
|
||||
@attr(tags=["advanced", "advancedns", "smoke", "basic", "eip", "sg"])
|
||||
def test_02_edit_service_offering(self):
|
||||
"""Test to update existing service offering"""
|
||||
|
|
@ -431,9 +446,11 @@ class TestServiceOfferings(cloudstackTestCase):
|
|||
self.small_offering.cpuspeed,
|
||||
"Check CPU Speed for small offering"
|
||||
)
|
||||
self.assertAlmostEqual(
|
||||
int(total_mem) / 1024, # In MBs
|
||||
int(self.small_offering.memory),
|
||||
self.assertTrue(
|
||||
self.isAlmostEqual(int(int(total_mem)/1024),
|
||||
int(self.small_offering.memory),
|
||||
range=20
|
||||
),
|
||||
"Check Memory(kb) for small offering"
|
||||
)
|
||||
return
|
||||
|
|
|
|||
Loading…
Reference in New Issue