You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ts...@apache.org on 2013/07/04 16:46:18 UTC

[2/2] git commit: updated refs/heads/master to da9552b

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 <ts...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/048cf5aa
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/048cf5aa
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/048cf5aa

Branch: refs/heads/master
Commit: 048cf5aae84786d2d3515a3199271e87c0c7bafb
Parents: daa4c32
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Wed Jul 3 23:37:52 2013 -0400
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Thu Jul 4 20:14:54 2013 +0530

----------------------------------------------------------------------
 .../integration/smoke/test_service_offerings.py | 23 +++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/048cf5aa/test/integration/smoke/test_service_offerings.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_service_offerings.py b/test/integration/smoke/test_service_offerings.py
index 0213c04..8b6b013 100644
--- a/test/integration/smoke/test_service_offerings.py
+++ b/test/integration/smoke/test_service_offerings.py
@@ -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